summaryrefslogtreecommitdiff
path: root/drivers/scsi
diff options
context:
space:
mode:
authorAlexey V. Vissarionov <gremlin@altlinux.org>2023-01-18 06:12:55 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-02-01 08:34:36 +0100
commiteced3d368f63b62c7258f31eb3e65198a5b4b659 (patch)
treedfb3a0f25528446475f80c222745747c9c531e2b /drivers/scsi
parent4ba7d17f2b3b60556e8e5832b55064d6bc800f0c (diff)
downloadlinux-riscv-eced3d368f63b62c7258f31eb3e65198a5b4b659.tar.gz
linux-riscv-eced3d368f63b62c7258f31eb3e65198a5b4b659.tar.bz2
linux-riscv-eced3d368f63b62c7258f31eb3e65198a5b4b659.zip
scsi: hpsa: Fix allocation size for scsi_host_alloc()
[ Upstream commit bbbd25499100c810ceaf5193c3cfcab9f7402a33 ] The 'h' is a pointer to struct ctlr_info, so it's just 4 or 8 bytes, while the structure itself is much bigger. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: edd163687ea5 ("hpsa: add driver for HP Smart Array controllers.") Link: https://lore.kernel.org/r/20230118031255.GE15213@altlinux.org Signed-off-by: Alexey V. Vissarionov <gremlin@altlinux.org> Acked-by: Don Brace <don.brace@microchip.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/hpsa.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 4dbf51e2623a..f6da34850af9 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -5850,7 +5850,7 @@ static int hpsa_scsi_host_alloc(struct ctlr_info *h)
{
struct Scsi_Host *sh;
- sh = scsi_host_alloc(&hpsa_driver_template, sizeof(h));
+ sh = scsi_host_alloc(&hpsa_driver_template, sizeof(struct ctlr_info));
if (sh == NULL) {
dev_err(&h->pdev->dev, "scsi_host_alloc failed\n");
return -ENOMEM;