From: Alexey V. Vissarionov Date: Wed, 18 Jan 2023 03:12:55 +0000 (+0300) Subject: scsi: hpsa: Fix allocation size for scsi_host_alloc() X-Git-Tag: baikal/aarch64/sdk5.9~63 X-Git-Url: https://git.baikalelectronics.ru/sdk/?a=commitdiff_plain;h=aca9c0a3696b14db01cee5735bb1cfa520ef4146;p=kernel.git 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: ef421ae82373 ("hpsa: add driver for HP Smart Array controllers.") Link: https://lore.kernel.org/r/20230118031255.GE15213@altlinux.org Signed-off-by: Alexey V. Vissarionov Acked-by: Don Brace Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c index ba125ed7e06a7..e670cce0cb6ef 100644 --- a/drivers/scsi/hpsa.c +++ b/drivers/scsi/hpsa.c @@ -5810,7 +5810,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;