From: 835703180@qq.com
To: chandu@amd.com
Cc: dev@dpdk.org, Shiqi Liu <835703180@qq.com>
Subject: [PATCH] crypto/ccp: Check for the NULL pointer after calling rte_malloc
Date: Sat, 9 Jul 2022 19:01:15 +0800 [thread overview]
Message-ID: <tencent_5A1578430CBABE04584679251A5D4910BE06@qq.com> (raw)
From: Shiqi Liu <835703180@qq.com>
As the possible failure of the rte_malloc(), the not_checked and
checked could be NULL pointer.
Therefore, it should be better to check it in order to avoid
the dereference of the NULL pointer.
Fixes: 09a0fd736a0 ("crypto/ccp: enable IOMMU")
Signed-off-by: Shiqi Liu <835703180@qq.com>
---
drivers/crypto/ccp/rte_ccp_pmd.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/crypto/ccp/rte_ccp_pmd.c b/drivers/crypto/ccp/rte_ccp_pmd.c
index a35a8cd775..776f928864 100644
--- a/drivers/crypto/ccp/rte_ccp_pmd.c
+++ b/drivers/crypto/ccp/rte_ccp_pmd.c
@@ -301,6 +301,9 @@ cryptodev_ccp_probe(struct rte_pci_driver *pci_drv __rte_unused,
};
sha_ctx = (void *)rte_malloc(NULL, SHA512_DIGEST_SIZE, 64);
+ if (sha_ctx == NULL) {
+ return -ENOMEM;
+ }
if (ccp_pmd_init_done) {
RTE_LOG(INFO, PMD, "CCP PMD already initialized\n");
return -EFAULT;
--
2.35.1.windows.2
next reply other threads:[~2022-07-09 11:02 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-09 11:01 835703180 [this message]
2022-07-20 6:29 ` Namburu, Chandu-babu
2022-07-20 13:43 ` David Marchand
2022-08-16 16:01 ` [EXT] " Akhil Goyal
2022-08-23 6:14 ` Namburu, Chandu-babu
2022-07-20 15:42 ` Stephen Hemminger
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=tencent_5A1578430CBABE04584679251A5D4910BE06@qq.com \
--to=835703180@qq.com \
--cc=chandu@amd.com \
--cc=dev@dpdk.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 NNTP newsgroup(s).