Re: [PATCH][next] RDMA/irdma: Fix issues with u8 left shift operation

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

 



On Sat, Jun 05, 2021 at 01:20:59PM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@xxxxxxxxxxxxx>
> 
> The shifting of the u8 integer info->map[i] the left will be promoted
> to a 32 bit signed int and then sign-extended to a u64. In the event
> that the top bit of the u8 is set then all then all the upper 32 bits
> of the u64 end up as also being set because of the sign-extension.
> Fix this by casting the u8 values to a u64 before the left shift. This
> 
> Addresses-Coverity: ("Unitentional integer overflow / bad shift operation")
> Fixes: 3f49d6842569 ("RDMA/irdma: Implement HW Admin Queue OPs")
> Signed-off-by: Colin Ian King <colin.king@xxxxxxxxxxxxx>
> Acked-by: Shiraz Saleem <shiraz.saleem@xxxxxxxxx>
> ---
>  drivers/infiniband/hw/irdma/ctrl.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied to for-next, thanks

Jason



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux