提交 83629a04 编写于 作者: A Alexey V. Vissarionov 提交者: sanglipeng

scsi: hpsa: Fix allocation size for scsi_host_alloc()

stable inclusion
from stable-v5.10.166
commit ce3aa7694627c35e761459d8dbd1b3b4ef0121ce
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I7TH9O

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=ce3aa7694627c35e761459d8dbd1b3b4ef0121ce

--------------------------------

[ Upstream commit bbbd2549 ]

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: edd16368 ("hpsa: add driver for HP Smart Array controllers.")
Link: https://lore.kernel.org/r/20230118031255.GE15213@altlinux.orgSigned-off-by: NAlexey V. Vissarionov <gremlin@altlinux.org>
Acked-by: NDon Brace <don.brace@microchip.com>
Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: Nsanglipeng <sanglipeng1@jd.com>
上级 9c34d25b
...@@ -5834,7 +5834,7 @@ static int hpsa_scsi_host_alloc(struct ctlr_info *h) ...@@ -5834,7 +5834,7 @@ static int hpsa_scsi_host_alloc(struct ctlr_info *h)
{ {
struct Scsi_Host *sh; 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) { if (sh == NULL) {
dev_err(&h->pdev->dev, "scsi_host_alloc failed\n"); dev_err(&h->pdev->dev, "scsi_host_alloc failed\n");
return -ENOMEM; return -ENOMEM;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册