mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] scsi: hpsa: add return value check for remap_pci_mem()
@ 2026-01-25 15:02 Haoxiang Li
  2026-01-26 12:53 ` Markus Elfring
  0 siblings, 1 reply; 2+ messages in thread
From: Haoxiang Li @ 2026-01-25 15:02 UTC (permalink / raw)
  To: don.brace, James.Bottomley, martin.petersen
  Cc: storagedev, linux-scsi, linux-kernel, Haoxiang Li

In hpsa_enter_performant_mode(), add return value check
for remap_pci_mem() to prevent potential null pointer
dereference.

Signed-off-by: Haoxiang Li <lihaoxiang@isrc.iscas.ac.cn>
---
 drivers/scsi/hpsa.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 3654b12c5d5a..f3118695f320 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -9323,6 +9323,8 @@ static int hpsa_enter_performant_mode(struct ctlr_info *h, u32 trans_support)
 					cfg_offset + bft2_offset,
 					ARRAY_SIZE(bft2) *
 					sizeof(*h->ioaccel2_bft2_regs));
+		if (!h->ioaccel2_bft2_regs)
+			return -ENODEV;
 		for (i = 0; i < ARRAY_SIZE(bft2); i++)
 			writel(bft2[i], &h->ioaccel2_bft2_regs[i]);
 	}
-- 
2.25.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-01-26 12:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-25 15:02 [PATCH] scsi: hpsa: add return value check for remap_pci_mem() Haoxiang Li
2026-01-26 12:53 ` Markus Elfring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®