ipmi_si: fix potential integer overflow on large shift
mainline inclusion from mainline-4.20-rc1 commit 97a103e6 category: bugfix bugzilla: 6325 CVE: NA --------------------------- Shifting unsigned char b by an int type can lead to sign-extension overflow. For example, if b is 0xff and the shift is 24, then top bit is sign-extended so the final value passed to writeq has all the upper 32 bits set. Fix this by casting b to a 64 bit unsigned before the shift. Detected by CoverityScan, CID#1465246 ("Unintended sign extension") Signed-off-by: NColin Ian King <colin.king@canonical.com> Signed-off-by: NCorey Minyard <cminyard@mvista.com> Signed-off-by: NJason Yan <yanaijie@huawei.com> Reviewed-by: Nzhengbin <zhengbin13@huawei.com> Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
Showing
想要评论请 注册 或 登录