lkml.org 
[lkml]   [2021]   [Dec]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] staging: unisys: potential dereference of null pointer
Date
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@iscas.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
\
 
 \ /
  Last update: 2021-12-15 10:22    [W:0.023 / U:1.248 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site