android_kernel_xiaomi_sm8350/drivers/scsi/aic7xxx
Colin Ian King 863c4bc883 scsi: aic7xxx: Fix unintentional sign extension issue on left shift of u8
[ Upstream commit 332a9dd1d86f1e7203fc7f0fd7e82f0b304200fe ]

The shifting of the u8 integer returned fom ahc_inb(ahc, port+3) by 24 bits
to 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 24
bit left shift.

[ This dates back to 2002, I found the offending commit from the git
history git://git.kernel.org/pub/scm/linux/kernel/git/tglx/history.git,
commit f58eb66c0b0a ("Update aic7xxx driver to 6.2.10...") ]

Link: https://lore.kernel.org/r/20210621151727.20667-1-colin.king@canonical.com
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Addresses-Coverity: ("Unintended sign extension")
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-07-25 14:35:12 +02:00
..
aicasm
.gitignore
aic7xxx_93cx6.c
aic7xxx_93cx6.h
aic7xxx_core.c
aic7xxx_inline.h
aic7xxx_osm_pci.c
aic7xxx_osm.c
aic7xxx_osm.h
aic7xxx_pci.c
aic7xxx_pci.h
aic7xxx_proc.c
aic7xxx_reg_print.c_shipped
aic7xxx_reg.h_shipped
aic7xxx_seq.h_shipped
aic7xxx.h
aic7xxx.reg
aic7xxx.seq
aic79xx_core.c
aic79xx_inline.h
aic79xx_osm_pci.c
aic79xx_osm.c
aic79xx_osm.h
aic79xx_pci.c
aic79xx_pci.h
aic79xx_proc.c
aic79xx_reg_print.c_shipped
aic79xx_reg.h_shipped
aic79xx_seq.h_shipped
aic79xx.h
aic79xx.reg
aic79xx.seq
aic7770_osm.c
aic7770.c
aiclib.h
cam.h
Kconfig.aic7xxx
Kconfig.aic79xx
Makefile
queue.h
scsi_iu.h
scsi_message.h