lkml.org 
[lkml]   [2024]   [Mar]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] misc: uacce - add the null check for the input pointer and its pointer members
Date
The uacce_alloc() is the member of the EXPORT_SYMBOL_GPL. Therefore, null
pointer verification is added on the pointer type input parameter and its
pointer members.

Signed-off-by: Chenghai Huang <huangchenghai2@huawei.com>
---
drivers/misc/uacce/uacce.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/drivers/misc/uacce/uacce.c b/drivers/misc/uacce/uacce.c
index bdc2e6fda782..964f1a6a16e0 100644
--- a/drivers/misc/uacce/uacce.c
+++ b/drivers/misc/uacce/uacce.c
@@ -514,6 +514,9 @@ struct uacce_device *uacce_alloc(struct device *parent,
struct uacce_device *uacce;
int ret;

+ if (!parent || !interface || !interface->ops)
+ return ERR_PTR(-EINVAL);
+
uacce = kzalloc(sizeof(struct uacce_device), GFP_KERNEL);
if (!uacce)
return ERR_PTR(-ENOMEM);
--
2.30.0

\
 
 \ /
  Last update: 2024-05-27 16:14    [W:0.159 / U:0.380 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site