Messages in this thread | | | From | Felipe Balbi <> | Subject | Re: [PATCH] usb: gadget: prevent a ternary sign expansion bug | Date | Thu, 22 Apr 2021 14:03:49 +0300 |
| |
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 [unhandled content-type:application/pgp-signature] | |