stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Colin Ian King <colin.king@canonical.com>,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	Sasha Levin <sashal@kernel.org>
Subject: [PATCH 4.19 030/120] scsi: aic7xxx: Fix unintentional sign extension issue on left shift of u8
Date: Mon, 26 Jul 2021 17:38:02 +0200	[thread overview]
Message-ID: <20210726153833.360530713@linuxfoundation.org> (raw)
In-Reply-To: <20210726153832.339431936@linuxfoundation.org>

From: Colin Ian King <colin.king@canonical.com>

[ 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>
---
 drivers/scsi/aic7xxx/aic7xxx_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/aic7xxx/aic7xxx_core.c b/drivers/scsi/aic7xxx/aic7xxx_core.c
index 49e02e874553..fe15746af520 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_core.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_core.c
@@ -500,7 +500,7 @@ ahc_inq(struct ahc_softc *ahc, u_int port)
 	return ((ahc_inb(ahc, port))
 	      | (ahc_inb(ahc, port+1) << 8)
 	      | (ahc_inb(ahc, port+2) << 16)
-	      | (ahc_inb(ahc, port+3) << 24)
+	      | (((uint64_t)ahc_inb(ahc, port+3)) << 24)
 	      | (((uint64_t)ahc_inb(ahc, port+4)) << 32)
 	      | (((uint64_t)ahc_inb(ahc, port+5)) << 40)
 	      | (((uint64_t)ahc_inb(ahc, port+6)) << 48)
-- 
2.30.2




  parent reply	other threads:[~2021-07-26 15:57 UTC|newest]

Thread overview: 130+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-26 15:37 [PATCH 4.19 000/120] 4.19.199-rc1 review Greg Kroah-Hartman
2021-07-26 15:37 ` [PATCH 4.19 001/120] ARM: dts: gemini: rename mdio to the right name Greg Kroah-Hartman
2021-07-26 15:37 ` [PATCH 4.19 002/120] ARM: dts: gemini: add device_type on pci Greg Kroah-Hartman
2021-07-26 15:37 ` [PATCH 4.19 003/120] ARM: dts: rockchip: fix pinctrl sleep nodename for rk3036-kylin and rk3288 Greg Kroah-Hartman
2021-07-26 15:37 ` [PATCH 4.19 004/120] arm64: dts: rockchip: fix pinctrl sleep nodename for rk3399.dtsi Greg Kroah-Hartman
2021-07-26 15:37 ` [PATCH 4.19 005/120] ARM: dts: rockchip: Fix the timer clocks order Greg Kroah-Hartman
2021-07-26 15:37 ` [PATCH 4.19 006/120] ARM: dts: rockchip: Fix IOMMU nodes properties on rk322x Greg Kroah-Hartman
2021-07-26 15:37 ` [PATCH 4.19 007/120] ARM: dts: rockchip: Fix power-controller node names for rk3288 Greg Kroah-Hartman
2021-07-26 15:37 ` [PATCH 4.19 008/120] arm64: dts: rockchip: Fix power-controller node names for rk3328 Greg Kroah-Hartman
2021-07-26 15:37 ` [PATCH 4.19 009/120] reset: ti-syscon: fix to_ti_syscon_reset_data macro Greg Kroah-Hartman
2021-07-26 15:37 ` [PATCH 4.19 010/120] ARM: brcmstb: dts: fix NAND nodes names Greg Kroah-Hartman
2021-07-26 15:37 ` [PATCH 4.19 011/120] ARM: Cygnus: " Greg Kroah-Hartman
2021-07-26 15:37 ` [PATCH 4.19 012/120] ARM: NSP: " Greg Kroah-Hartman
2021-07-26 15:37 ` [PATCH 4.19 013/120] ARM: dts: BCM63xx: Fix " Greg Kroah-Hartman
2021-07-26 15:37 ` [PATCH 4.19 014/120] ARM: dts: Hurricane 2: " Greg Kroah-Hartman
2021-07-26 15:37 ` [PATCH 4.19 015/120] ARM: dts: imx6: phyFLEX: Fix UART hardware flow control Greg Kroah-Hartman
2021-07-26 15:37 ` [PATCH 4.19 016/120] ARM: imx: pm-imx5: Fix references to imx5_cpu_suspend_info Greg Kroah-Hartman
2021-07-26 15:37 ` [PATCH 4.19 017/120] rtc: mxc_v2: add missing MODULE_DEVICE_TABLE Greg Kroah-Hartman
2021-07-26 15:37 ` [PATCH 4.19 018/120] ARM: dts: stm32: fix gpio-keys node on STM32 MCU boards Greg Kroah-Hartman
2021-07-26 15:37 ` [PATCH 4.19 019/120] ARM: dts: stm32: fix RCC node name on stm32f429 MCU Greg Kroah-Hartman
2021-07-26 15:37 ` [PATCH 4.19 020/120] ARM: dts: stm32: fix timer nodes on STM32 MCU to prevent warnings Greg Kroah-Hartman
2021-07-26 15:37 ` [PATCH 4.19 021/120] arm64: dts: juno: Update SCPI nodes as per the YAML schema Greg Kroah-Hartman
2021-07-26 15:37 ` [PATCH 4.19 022/120] ARM: dts: rockchip: fix supply properties in io-domains nodes Greg Kroah-Hartman
2021-07-26 15:37 ` [PATCH 4.19 023/120] ARM: dts: stm32: fix i2c node name on stm32f746 to prevent warnings Greg Kroah-Hartman
2021-07-26 15:37 ` [PATCH 4.19 024/120] ARM: dts: stm32: move stmmac axi config in ethernet node on stm32mp15 Greg Kroah-Hartman
2021-07-26 15:37 ` [PATCH 4.19 025/120] soc/tegra: fuse: Fix Tegra234-only builds Greg Kroah-Hartman
2021-07-26 15:37 ` [PATCH 4.19 026/120] arm64: dts: ls208xa: remove bus-num from dspi node Greg Kroah-Hartman
2021-07-26 15:37 ` [PATCH 4.19 027/120] thermal/core: Correct function name thermal_zone_device_unregister() Greg Kroah-Hartman
2021-07-26 15:38 ` [PATCH 4.19 028/120] kbuild: mkcompile_h: consider timestamp if KBUILD_BUILD_TIMESTAMP is set Greg Kroah-Hartman
2021-07-26 15:38 ` [PATCH 4.19 029/120] rtc: max77686: Do not enforce (incorrect) interrupt trigger type Greg Kroah-Hartman
2021-07-26 15:38 ` Greg Kroah-Hartman [this message]
2021-07-26 15:38 ` [PATCH 4.19 031/120] scsi: libsas: Add LUN number check in .slave_alloc callback Greg Kroah-Hartman
2021-07-26 15:38 ` [PATCH 4.19 032/120] scsi: libfc: Fix array index out of bound exception Greg Kroah-Hartman
2021-07-26 15:38 ` [PATCH 4.19 033/120] sched/fair: Fix CFS bandwidth hrtimer expiry type Greg Kroah-Hartman
2021-07-26 15:38 ` [PATCH 4.19 034/120] mm: slab: fix kmem_cache_create failed when sysfs node not destroyed Greg Kroah-Hartman
2021-07-26 15:38 ` [PATCH 4.19 035/120] dm writecache: return the exact table values that were set Greg Kroah-Hartman
2021-07-26 15:38 ` [PATCH 4.19 036/120] dm writecache: fix writing beyond end of underlying device when shrinking Greg Kroah-Hartman
2021-07-26 15:38 ` [PATCH 4.19 037/120] net: dsa: mv88e6xxx: enable .rmu_disable() on Topaz Greg Kroah-Hartman
2021-07-26 15:38 ` [PATCH 4.19 038/120] net: ipv6: fix return value of ip6_skb_dst_mtu Greg Kroah-Hartman
2021-07-26 15:38 ` [PATCH 4.19 039/120] netfilter: ctnetlink: suspicious RCU usage in ctnetlink_dump_helpinfo Greg Kroah-Hartman
2021-07-26 15:38 ` [PATCH 4.19 040/120] net: bridge: sync fdb to new unicast-filtering ports Greg Kroah-Hartman
2021-07-26 15:38 ` [PATCH 4.19 041/120] net: bcmgenet: Ensure all TX/RX queues DMAs are disabled Greg Kroah-Hartman
2021-07-26 15:38 ` [PATCH 4.19 042/120] net: moxa: fix UAF in moxart_mac_probe Greg Kroah-Hartman
2021-07-26 15:38 ` [PATCH 4.19 043/120] net: qcom/emac: fix UAF in emac_remove Greg Kroah-Hartman
2021-07-26 15:38 ` [PATCH 4.19 044/120] net: ti: fix UAF in tlan_remove_one Greg Kroah-Hartman
2021-07-26 15:38 ` [PATCH 4.19 045/120] net: send SYNACK packet with accepted fwmark Greg Kroah-Hartman
2021-07-26 15:38 ` [PATCH 4.19 046/120] net: validate lwtstate->data before returning from skb_tunnel_info() Greg Kroah-Hartman
2021-07-26 15:38 ` [PATCH 4.19 047/120] dma-buf/sync_file: Dont leak fences on merge failure Greg Kroah-Hartman
2021-07-26 15:38 ` [PATCH 4.19 048/120] tcp: annotate data races around tp->mtu_info Greg Kroah-Hartman
2021-07-26 15:38 ` [PATCH 4.19 049/120] ipv6: tcp: drop silly ICMPv6 packet too big messages Greg Kroah-Hartman
2021-07-26 15:38 ` [PATCH 4.19 050/120] bpftool: Properly close va_list ap by va_end() on error Greg Kroah-Hartman
2021-07-26 15:38 ` [PATCH 4.19 051/120] udp: annotate data races around unix_sk(sk)->gso_size Greg Kroah-Hartman
2021-07-26 15:38 ` [PATCH 4.19 052/120] net: ip_tunnel: fix mtu calculation for ETHER tunnel devices Greg Kroah-Hartman
2021-07-26 15:38 ` [PATCH 4.19 053/120] igb: Fix use-after-free error during reset Greg Kroah-Hartman
2021-07-26 15:38 ` [PATCH 4.19 054/120] ixgbe: Fix an error handling path in ixgbe_probe() Greg Kroah-Hartman
2021-07-26 15:38 ` [PATCH 4.19 055/120] igb: Fix an error handling path in igb_probe() Greg Kroah-Hartman
2021-07-26 15:38 ` [PATCH 4.19 056/120] fm10k: Fix an error handling path in fm10k_probe() Greg Kroah-Hartman
2021-07-26 15:38 ` [PATCH 4.19 057/120] e1000e: Fix an error handling path in e1000_probe() Greg Kroah-Hartman
2021-07-26 15:38 ` [PATCH 4.19 058/120] iavf: Fix an error handling path in iavf_probe() Greg Kroah-Hartman
2021-07-26 15:38 ` [PATCH 4.19 059/120] igb: Check if num of q_vectors is smaller than max before array access Greg Kroah-Hartman
2021-07-26 15:38 ` [PATCH 4.19 060/120] igb: Fix position of assignment to *ring Greg Kroah-Hartman
2021-07-26 15:38 ` [PATCH 4.19 061/120] ipv6: fix disable_policy for fwd packets Greg Kroah-Hartman
2021-07-26 15:38 ` [PATCH 4.19 062/120] nvme-pci: do not call nvme_dev_remove_admin from nvme_remove Greg Kroah-Hartman
2021-07-26 15:38 ` [PATCH 4.19 063/120] perf map: Fix dso->nsinfo refcounting Greg Kroah-Hartman
2021-07-26 15:38 ` [PATCH 4.19 064/120] perf probe: " Greg Kroah-Hartman
2021-07-26 15:38 ` [PATCH 4.19 065/120] perf test session_topology: Delete session->evlist Greg Kroah-Hartman
2021-07-27  3:44   ` Naresh Kamboju
2021-07-27  6:10     ` Greg Kroah-Hartman
2021-07-26 15:38 ` [PATCH 4.19 066/120] perf dso: Fix memory leak in dso__new_map() Greg Kroah-Hartman
2021-07-26 15:38 ` [PATCH 4.19 067/120] perf script: Fix memory threads and cpus leaks on exit Greg Kroah-Hartman
2021-07-26 15:38 ` [PATCH 4.19 068/120] perf lzma: Close lzma stream " Greg Kroah-Hartman
2021-07-26 15:38 ` [PATCH 4.19 069/120] perf test bpf: Free obj_buf Greg Kroah-Hartman
2021-07-26 15:38 ` [PATCH 4.19 070/120] perf probe-file: Delete namelist in del_events() on the error path Greg Kroah-Hartman
2021-07-26 15:38 ` [PATCH 4.19 071/120] spi: mediatek: fix fifo rx mode Greg Kroah-Hartman
2021-07-26 15:38 ` [PATCH 4.19 072/120] liquidio: Fix unintentional sign extension issue on left shift of u16 Greg Kroah-Hartman
2021-07-26 15:38 ` [PATCH 4.19 073/120] s390/bpf: Perform r1 range checking before accessing jit->seen_reg[r1] Greg Kroah-Hartman
2021-07-26 15:38 ` [PATCH 4.19 074/120] bpftool: Check malloc return value in mount_bpffs_for_pin Greg Kroah-Hartman
2021-07-26 15:38 ` [PATCH 4.19 075/120] net: fix uninit-value in caif_seqpkt_sendmsg Greg Kroah-Hartman
2021-07-26 15:38 ` [PATCH 4.19 076/120] net: decnet: Fix sleeping inside in af_decnet Greg Kroah-Hartman
2021-07-26 15:38 ` [PATCH 4.19 077/120] KVM: PPC: Fix kvm_arch_vcpu_ioctl vcpu_load leak Greg Kroah-Hartman
2021-07-26 15:38 ` [PATCH 4.19 078/120] netrom: Decrease sock refcount when sock timers expire Greg Kroah-Hartman
2021-07-26 15:38 ` [PATCH 4.19 079/120] scsi: iscsi: Fix iface sysfs attr detection Greg Kroah-Hartman
2021-07-26 15:38 ` [PATCH 4.19 080/120] scsi: target: Fix protect handling in WRITE SAME(32) Greg Kroah-Hartman
2021-07-26 15:38 ` [PATCH 4.19 081/120] spi: cadence: Correct initialisation of runtime PM again Greg Kroah-Hartman
2021-07-26 15:38 ` [PATCH 4.19 082/120] net/tcp_fastopen: fix data races around tfo_active_disable_stamp Greg Kroah-Hartman
2021-07-26 15:38 ` [PATCH 4.19 083/120] net/sched: act_skbmod: Skip non-Ethernet packets Greg Kroah-Hartman
2021-07-26 15:38 ` [PATCH 4.19 084/120] nvme-pci: dont WARN_ON in nvme_reset_work if ctrl.state is not RESETTING Greg Kroah-Hartman
2021-07-26 15:38 ` [PATCH 4.19 085/120] Revert "USB: quirks: ignore remote wake-up on Fibocom L850-GL LTE modem" Greg Kroah-Hartman
2021-07-26 15:38 ` [PATCH 4.19 086/120] sctp: update active_key for asoc when old key is being replaced Greg Kroah-Hartman
2021-07-26 15:38 ` [PATCH 4.19 087/120] net: sched: cls_api: Fix the the wrong parameter Greg Kroah-Hartman
2021-07-26 15:39 ` [PATCH 4.19 088/120] drm/panel: raspberrypi-touchscreen: Prevent double-free Greg Kroah-Hartman
2021-07-26 15:39 ` [PATCH 4.19 089/120] proc: Avoid mixing integer types in mem_rw() Greg Kroah-Hartman
2021-07-26 15:39 ` [PATCH 4.19 090/120] [PATCH] Revert "MIPS: add PMD table accounting into MIPSpmd_alloc_one" Greg Kroah-Hartman
2021-07-26 15:39 ` [PATCH 4.19 091/120] s390/ftrace: fix ftrace_update_ftrace_func implementation Greg Kroah-Hartman
2021-07-26 15:39 ` [PATCH 4.19 092/120] ALSA: usb-audio: Add registration quirk for JBL Quantum headsets Greg Kroah-Hartman
2021-07-26 15:39 ` [PATCH 4.19 093/120] ALSA: sb: Fix potential ABBA deadlock in CSP driver Greg Kroah-Hartman
2021-07-26 15:39 ` [PATCH 4.19 094/120] xhci: Fix lost USB 2 remote wake Greg Kroah-Hartman
2021-07-26 15:39 ` [PATCH 4.19 095/120] KVM: PPC: Book3S: Fix H_RTAS rets buffer overflow Greg Kroah-Hartman
2021-07-26 15:39 ` [PATCH 4.19 096/120] usb: hub: Disable USB 3 device initiated lpm if exit latency is too high Greg Kroah-Hartman
2021-07-26 15:39 ` [PATCH 4.19 097/120] usb: hub: Fix link power management max exit latency (MEL) calculations Greg Kroah-Hartman
2021-07-26 15:39 ` [PATCH 4.19 098/120] USB: usb-storage: Add LaCie Rugged USB3-FW to IGNORE_UAS Greg Kroah-Hartman
2021-07-26 15:39 ` [PATCH 4.19 099/120] usb: max-3421: Prevent corruption of freed memory Greg Kroah-Hartman
2021-07-26 15:39 ` [PATCH 4.19 100/120] usb: renesas_usbhs: Fix superfluous irqs happen after usb_pkt_pop() Greg Kroah-Hartman
2021-07-26 15:39 ` [PATCH 4.19 101/120] USB: serial: option: add support for u-blox LARA-R6 family Greg Kroah-Hartman
2021-07-26 15:39 ` [PATCH 4.19 102/120] USB: serial: cp210x: fix comments for GE CS1000 Greg Kroah-Hartman
2021-07-26 15:39 ` [PATCH 4.19 103/120] USB: serial: cp210x: add ID for CEL EM3588 USB ZigBee stick Greg Kroah-Hartman
2021-07-26 15:39 ` [PATCH 4.19 104/120] usb: dwc2: gadget: Fix sending zero length packet in DDMA mode Greg Kroah-Hartman
2021-07-26 15:39 ` [PATCH 4.19 105/120] tracing: Fix bug in rb_per_cpu_empty() that might cause deadloop Greg Kroah-Hartman
2021-07-26 15:39 ` [PATCH 4.19 106/120] media: ngene: Fix out-of-bounds bug in ngene_command_config_free_buf() Greg Kroah-Hartman
2021-07-26 15:39 ` [PATCH 4.19 107/120] ixgbe: Fix packet corruption due to missing DMA sync Greg Kroah-Hartman
2021-07-26 15:39 ` [PATCH 4.19 108/120] selftest: use mmap instead of posix_memalign to allocate memory Greg Kroah-Hartman
2021-07-26 15:39 ` [PATCH 4.19 109/120] nds32: fix up stack guard gap Greg Kroah-Hartman
2021-07-26 15:39 ` [PATCH 4.19 110/120] drm: Return -ENOTTY for non-drm ioctls Greg Kroah-Hartman
2021-07-26 15:39 ` [PATCH 4.19 111/120] KVM: do not assume PTE is writable after follow_pfn Greg Kroah-Hartman
2021-07-26 21:17   ` Sudip Mukherjee
2021-07-26 22:02     ` Paolo Bonzini
2021-07-27  8:33       ` Ovidiu Panait
2021-07-26 15:39 ` [PATCH 4.19 112/120] KVM: do not allow mapping valid but non-reference-counted pages Greg Kroah-Hartman
2021-07-26 15:39 ` [PATCH 4.19 113/120] net: dsa: mv88e6xxx: use correct .stats_set_histogram() on Topaz Greg Kroah-Hartman
2021-07-26 15:39 ` [PATCH 4.19 114/120] net: bcmgenet: ensure EXT_ENERGY_DET_MASK is clear Greg Kroah-Hartman
2021-07-26 15:39 ` [PATCH 4.19 115/120] iio: accel: bma180: Use explicit member assignment Greg Kroah-Hartman
2021-07-26 15:39 ` [PATCH 4.19 116/120] iio: accel: bma180: Fix BMA25x bandwidth register values Greg Kroah-Hartman
2021-07-26 15:39 ` [PATCH 4.19 117/120] btrfs: compression: dont try to compress if we dont have enough pages Greg Kroah-Hartman
2021-07-26 15:39 ` [PATCH 4.19 118/120] PCI: Mark AMD Navi14 GPU ATS as broken Greg Kroah-Hartman
2021-07-26 15:39 ` [PATCH 4.19 119/120] spi: spi-fsl-dspi: Fix a resource leak in an error handling path Greg Kroah-Hartman
2021-07-26 15:39 ` [PATCH 4.19 120/120] xhci: add xhci_get_virt_ep() helper Greg Kroah-Hartman
2021-07-26 19:35 ` [PATCH 4.19 000/120] 4.19.199-rc1 review Guenter Roeck
2021-07-27  3:56   ` Naresh Kamboju
2021-07-27  6:12   ` Greg Kroah-Hartman
2021-07-27  0:36 ` Shuah Khan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210726153833.360530713@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=colin.king@canonical.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=sashal@kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).