As the possible failure of the ioremap(), the 'data->MmioAddress' could
be NULL.
Therefore it should be better to check it in order to transfer the
error.
Fixes: 0e6f9d270840 ("pcmcia: use pcmcia_loop_config in scsi pcmcia drivers")
Signed-off-by: Jiasheng Jiang <[email protected]>
---
drivers/scsi/pcmcia/nsp_cs.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c
index ac89002646a3..bcd61439ca3f 100644
--- a/drivers/scsi/pcmcia/nsp_cs.c
+++ b/drivers/scsi/pcmcia/nsp_cs.c
@@ -1560,6 +1560,9 @@ static int nsp_cs_config_check(struct pcmcia_device *p_dev, void *priv_data)
data->MmioAddress = (unsigned long)
ioremap(p_dev->resource[2]->start,
resource_size(p_dev->resource[2]));
+ if (!data->MmioAddress)
+ goto next_entry;
+
data->MmioLength = resource_size(p_dev->resource[2]);
}
/* If we got this far, we're cool! */
--
2.25.1
On Thu, 30 Dec 2021 10:11:37 +0800, Jiasheng Jiang wrote:
> As the possible failure of the ioremap(), the 'data->MmioAddress' could
> be NULL.
> Therefore it should be better to check it in order to transfer the
> error.
>
>
Applied to 5.17/scsi-queue, thanks!
[1/1] scsi: nsp_cs: Check of ioremap return value
https://git.kernel.org/mkp/scsi/c/2576e153cd98
--
Martin K. Petersen Oracle Linux Engineering