Linux SCSI subsystem development
 help / color / mirror / Atom feed
From: "Alexey V. Vissarionov" <gremlin@altlinux.org>
To: Bart Van Assche <bvanassche@acm.org>
Cc: "Alexey V. Vissarionov" <gremlin@altlinux.org>,
	Alexey Khoroshilov <khoroshilov@ispras.ru>,
	linux-scsi@vger.kernel.org,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	"James E.J. Bottomley" <jejb@linux.ibm.com>,
	"Stephen M. Cameron" <scameron@beardog.cce.hp.com>,
	storagedev@microchip.com, Don Brace <don.brace@microchip.com>,
	lvc-project@linuxtesting.org
Subject: [PATCH] scsi: hpsa: fix allocation size for scsi_host_alloc()
Date: Wed, 18 Jan 2023 06:12:55 +0300	[thread overview]
Message-ID: <20230118031255.GE15213@altlinux.org> (raw)
In-Reply-To: <531f3f82-712c-eb0b-d22d-710e8a36b3c2@acm.org>

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

On 2023-01-17 13:23:19 -0800, Bart Van Assche wrote:

 > My understanding is that you used an incorrect commit hash.
 > Hence, it is up to you to fix the commit hash.

ACK. Resending:


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 ("[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-18  3:13 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-16 13:31 [PATCH] scsi: hpsa: fix allocation size for scsi_host_alloc() Alexey V. Vissarionov
2023-01-16 22:41 ` 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 [this message]
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=20230118031255.GE15213@altlinux.org \
    --to=gremlin@altlinux.org \
    --cc=bvanassche@acm.org \
    --cc=don.brace@microchip.com \
    --cc=jejb@linux.ibm.com \
    --cc=khoroshilov@ispras.ru \
    --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