Skip to content

Commit

Permalink
scsi: hpsa: Fix allocation size for scsi_host_alloc()
Browse files Browse the repository at this point in the history
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: edd1636 ("hpsa: add driver for HP Smart Array controllers.")
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Alexey V. Vissarionov <[email protected]>
Acked-by: Don Brace <[email protected]>
Signed-off-by: Martin K. Petersen <[email protected]>
  • Loading branch information
Alexey V. Vissarionov authored and martinkpetersen committed Jan 18, 2023
1 parent 84ed64b commit bbbd254
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/scsi/hpsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit bbbd254

Please sign in to comment.