Re: [PATCH] net: sxgbe: fix unintended sign extension

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

 



From: Colin King <colin.king@xxxxxxxxxxxxx>
Date: Wed,  6 Feb 2019 10:25:03 +0000

> From: Colin Ian King <colin.king@xxxxxxxxxxxxx>
> 
> Shifting a u8 by 24 will cause the value to be promoted to an integer. If
> the top bit of the u8 is set then the following conversion to an unsigned
> long will sign extend the value causing the upper 32 bits to be set in
> the result.

We feed this into a writel() which truncates to a 32-bit value, so nothing
bad can happen here.

This is a very canonical way to code up something like this, it works
properly in all situations, and therefore I'd rather not add all of
these fat ugly looking casts.

Thank you.




[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