Skip to content
Commit 7fde2dbe authored by Colin Ian King's avatar Colin Ian King Committed by Jason Gunthorpe
Browse files

RDMA/irdma: Fix issues with u8 left shift operation

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

Link: https://lore.kernel.org/r/20210605122059.25105-1-colin.king@canonical.com


Addresses-Coverity: ("Unitentional integer overflow / bad shift operation")
Fixes: 3f49d684 ("RDMA/irdma: Implement HW Admin Queue OPs")
Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
Acked-by: default avatarShiraz Saleem <shiraz.saleem@intel.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
parent aeb27bb7
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment