[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <87im4emvhm.fsf@kernel.org>
Date: Thu, 22 Apr 2021 14:03:49 +0300
From: Felipe Balbi <balbi@...nel.org>
To: Dan Carpenter <dan.carpenter@...cle.com>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Alan Stern <stern@...land.harvard.edu>,
Jens Axboe <axboe@...nel.dk>,
Felix Kuehling <Felix.Kuehling@....com>,
Andrew Morton <akpm@...ux-foundation.org>,
"Gustavo A. R. Silva" <gustavoars@...nel.org>,
Masahiro Yamada <masahiroy@...nel.org>,
Zhang Qilong <zhangqilong3@...wei.com>,
linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] usb: gadget: prevent a ternary sign expansion bug
Dan Carpenter <dan.carpenter@...cle.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@...cle.com>
I'm just going to assume your type promotion rank is correct :-)
Acked-by: Felipe Balbi <balbi@...nel.org>
--
balbi
Download attachment "signature.asc" of type "application/pgp-signature" (858 bytes)
Powered by blists - more mailing lists