Re: [PATCH] usb: gadget: prevent a ternary sign expansion bug

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dan Carpenter <dan.carpenter@xxxxxxxxxx> 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@xxxxxxxxxx>

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

Acked-by: Felipe Balbi <balbi@xxxxxxxxxx>

-- 
balbi

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux