[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20211215092155.141029-1-jiasheng@iscas.ac.cn>
Date: Wed, 15 Dec 2021 17:21:55 +0800
From: Jiasheng Jiang <jiasheng@...as.ac.cn>
To: david.kershner@...sys.com, gregkh@...uxfoundation.org,
chensong_2000@....cn
Cc: sparmaintainer@...sys.com, linux-staging@...ts.linux.dev,
linux-kernel@...r.kernel.org, Jiasheng Jiang <jiasheng@...as.ac.cn>
Subject: [PATCH] staging: unisys: potential dereference of null pointer
The return value of kmalloc() needs to be checked.
To avoid devdata->cmdrsp to be null in case of the failure of alloc.
Fixes: d2c3506be646 ("staging: unisys: Add s-Par visorhba")
Signed-off-by: Jiasheng Jiang <jiasheng@...as.ac.cn>
---
drivers/staging/unisys/visorhba/visorhba_main.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/staging/unisys/visorhba/visorhba_main.c b/drivers/staging/unisys/visorhba/visorhba_main.c
index 4455d26f7c96..a23c300447e9 100644
--- a/drivers/staging/unisys/visorhba/visorhba_main.c
+++ b/drivers/staging/unisys/visorhba/visorhba_main.c
@@ -1056,6 +1056,9 @@ static int visorhba_probe(struct visor_device *dev)
idr_init(&devdata->idr);
devdata->cmdrsp = kmalloc(sizeof(*devdata->cmdrsp), GFP_ATOMIC);
+ if (!devdata->cmdrsp)
+ goto err_debugfs_info;
+
visorbus_enable_channel_interrupts(dev);
scsi_scan_host(scsihost);
--
2.25.1
Powered by blists - more mailing lists