[PATCH] staging: unisys: potential dereference of null pointer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxx>
---
 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





[Index of Archives]     [Linux Driver Development]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux