diff mbox series

scsi: hpsa: Fix allocation size for Scsi_Host private data

Message ID 20240312170447.743709-1-YKarpov@ispras.ru (mailing list archive)
State New, archived
Headers show
Series scsi: hpsa: Fix allocation size for Scsi_Host private data | expand

Commit Message

Yuri Karpov March 12, 2024, 5:04 p.m. UTC
struct Scsi_Host private data contains pointer to struct ctlr_info.

Restore allocation of only 8 bytes to store pointer in struct Scsi_Host
 private data area.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: bbbd25499100 ("scsi: hpsa: Fix allocation size for scsi_host_alloc()")
Signed-off-by: Yuri Karpov <YKarpov@ispras.ru>
---
 drivers/scsi/hpsa.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Martin K. Petersen May 7, 2024, 1:59 a.m. UTC | #1
On Tue, 12 Mar 2024 20:04:47 +0300, Yuri Karpov wrote:

> struct Scsi_Host private data contains pointer to struct ctlr_info.
> 
> Restore allocation of only 8 bytes to store pointer in struct Scsi_Host
>  private data area.
> 
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
> 
> [...]

Applied to 6.10/scsi-queue, thanks!

[1/1] scsi: hpsa: Fix allocation size for Scsi_Host private data
      https://git.kernel.org/mkp/scsi/c/504e2bed5d50
diff mbox series

Patch

diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index af18d20f3079..4ad32de61bb8 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(struct ctlr_info));
+	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;