All of lore.kernel.org
 help / color / mirror / Atom feed
From: Felipe Balbi <balbi@kernel.org>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Alan Stern <stern@rowland.harvard.edu>,
	Jens Axboe <axboe@kernel.dk>,
	Felix Kuehling <Felix.Kuehling@amd.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	"Gustavo A. R. Silva" <gustavoars@kernel.org>,
	Masahiro Yamada <masahiroy@kernel.org>,
	Zhang Qilong <zhangqilong3@huawei.com>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] usb: gadget: prevent a ternary sign expansion bug
Date: Thu, 22 Apr 2021 14:03:49 +0300	[thread overview]
Message-ID: <87im4emvhm.fsf@kernel.org> (raw)
In-Reply-To: <YIE7RrBPLWc3XtMg@mwanda>

[-- Attachment #1: Type: text/plain, Size: 733 bytes --]

Dan Carpenter <dan.carpenter@oracle.com> writes:

> The problem is that "req->actual" is a u32, "req->status" is an int, and
> iocb->ki_complete() takes a long.  We would expect that a negative error
> code in "req->status" would translate to a negative long value.
>
> But what actually happens is that because "req->actual" is a u32, the
> error codes is type promoted to a high positive value and then remains
> a positive value when it is cast to long.  (No sign expansion).
>
> We can fix this by casting "req->status" to long.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

I'm just going to assume your type promotion rank is correct :-)

Acked-by: Felipe Balbi <balbi@kernel.org>

-- 
balbi

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 857 bytes --]

      reply	other threads:[~2021-04-22 11:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-22  9:00 [PATCH] usb: gadget: prevent a ternary sign expansion bug Dan Carpenter
2021-04-22 11:03 ` Felipe Balbi [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87im4emvhm.fsf@kernel.org \
    --to=balbi@kernel.org \
    --cc=Felix.Kuehling@amd.com \
    --cc=akpm@linux-foundation.org \
    --cc=axboe@kernel.dk \
    --cc=dan.carpenter@oracle.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=gustavoars@kernel.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=stern@rowland.harvard.edu \
    --cc=zhangqilong3@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.