Linux SCSI subsystem development
 help / color / mirror / Atom feed
From: "Alexey V. Vissarionov" <gremlin@altlinux.org>
To: Don Brace <don.brace@microchip.com>
Cc: "James E.J. Bottomley" <jejb@linux.ibm.com>,
	James Bottomley <JBottomley@parallels.com>,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	"Stephen M. Cameron" <scameron@beardog.cce.hp.com>,
	storagedev@microchip.com, linux-scsi@vger.kernel.org,
	lvc-project@linuxtesting.org, gremlin@altlinux.org
Subject: [PATCH] scsi: hpsa: fix allocation size for scsi_host_alloc()
Date: Mon, 16 Jan 2023 16:31:40 +0300	[thread overview]
Message-ID: <20230116133140.GB8107@altlinux.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 997 bytes --]

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: b705690d8d16f708 ("[SCSI] hpsa: combine hpsa_scsi_detect and hpsa_register_scsi")
Signed-off-by: Alexey V. Vissarionov <gremlin@altlinux.org>

diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 4dbf51e2623ad543..f6da34850af9dd46 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;


-- 
Alexey V. Vissarionov
gremlin ПРИ altlinux ТЧК org; +vii-cmiii-ccxxix-lxxix-xlii
GPG: 0D92F19E1C0DC36E27F61A29CD17E2B43D879005 @ hkp://keys.gnupg.net

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

             reply	other threads:[~2023-01-16 13:38 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-16 13:31 Alexey V. Vissarionov [this message]
2023-01-16 22:41 ` [PATCH] scsi: hpsa: fix allocation size for scsi_host_alloc() Bart Van Assche
2023-01-17  9:56   ` Alexey V. Vissarionov
2023-01-17 10:35     ` [lvc-project] " Alexey Khoroshilov
2023-01-17 21:12       ` Alexey V. Vissarionov
2023-01-17 21:23         ` Bart Van Assche
2023-01-18  3:12           ` Alexey V. Vissarionov
2023-01-19  0:06             ` Martin K. Petersen
2023-01-19  0:21             ` Martin K. Petersen

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=20230116133140.GB8107@altlinux.org \
    --to=gremlin@altlinux.org \
    --cc=JBottomley@parallels.com \
    --cc=don.brace@microchip.com \
    --cc=jejb@linux.ibm.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=lvc-project@linuxtesting.org \
    --cc=martin.petersen@oracle.com \
    --cc=scameron@beardog.cce.hp.com \
    --cc=storagedev@microchip.com \
    /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