From: Chenghai Huang <huangchenghai2@huawei.com>
To: <gregkh@linuxfoundation.org>, <zhangfei.gao@linaro.org>,
<wangzhou1@hisilicon.com>
Cc: <linux-kernel@vger.kernel.org>, <linux-crypto@vger.kernel.org>,
<fanghao11@huawei.com>, <shenyang39@huawei.com>,
<liulongfang@huawei.com>, <qianweili@huawei.com>
Subject: [PATCH] misc: uacce - add the null check for the input pointer and its pointer members
Date: Fri, 29 Mar 2024 14:26:55 +0800 [thread overview]
Message-ID: <20240329062655.3055646-1-huangchenghai2@huawei.com> (raw)
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
next reply other threads:[~2024-03-29 6:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-29 6:26 Chenghai Huang [this message]
2024-03-29 6:34 ` [PATCH] misc: uacce - add the null check for the input pointer and its pointer members Greg KH
[not found] ` <d6890b98-2f75-4077-b7bc-e995e9901574@huawei.com>
2024-03-30 7:01 ` Greg KH
2024-03-30 7:10 ` huangchenghai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240329062655.3055646-1-huangchenghai2@huawei.com \
--to=huangchenghai2@huawei.com \
--cc=fanghao11@huawei.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=liulongfang@huawei.com \
--cc=qianweili@huawei.com \
--cc=shenyang39@huawei.com \
--cc=wangzhou1@hisilicon.com \
--cc=zhangfei.gao@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).