From: "Zhang, Qi Z" <qi.z.zhang@intel.com>
To: Weiguo Li <liwg06@foxmail.com>, "Wu, Jingjing" <jingjing.wu@intel.com>
Cc: "Nicolau, Radu" <radu.nicolau@intel.com>, "dev@dpdk.org" <dev@dpdk.org>
Subject: RE: [PATCH] net/iavf: fix null pointer dereference
Date: Fri, 28 Jan 2022 08:50:53 +0000 [thread overview]
Message-ID: <6bed1ee37d76474bbf2a54218734e70a@intel.com> (raw)
In-Reply-To: <tencent_B6425387F37B6E645DC42D268F67E5D43205@qq.com>
> -----Original Message-----
> From: Weiguo Li <liwg06@foxmail.com>
> Sent: Tuesday, January 25, 2022 10:23 PM
> To: Wu, Jingjing <jingjing.wu@intel.com>
> Cc: Nicolau, Radu <radu.nicolau@intel.com>; dev@dpdk.org
> Subject: [PATCH] net/iavf: fix null pointer dereference
>
> Check for memory allocation failure is added to avoid null pointer
> dereference.
>
> Fixes: 6bc987ecb860 ("net/iavf: support IPsec inline crypto")
>
> Signed-off-by: Weiguo Li <liwg06@foxmail.com>
> ---
> drivers/net/iavf/iavf_ipsec_crypto.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/net/iavf/iavf_ipsec_crypto.c
> b/drivers/net/iavf/iavf_ipsec_crypto.c
> index adf101ab8a..ac67aa28f7 100644
> --- a/drivers/net/iavf/iavf_ipsec_crypto.c
> +++ b/drivers/net/iavf/iavf_ipsec_crypto.c
> @@ -1352,6 +1352,8 @@ iavf_ipsec_crypto_set_security_capabililites(struct
> iavf_security_ctx
> capabilities = rte_zmalloc("crypto_cap",
> sizeof(struct rte_cryptodev_capabilities) *
> (number_of_capabilities + 1), 0);
> + if (!capabilities)
> + return (-ENOMEM);
Better to unwrap the bracket to keep coding style consistent
> capabilities[number_of_capabilities].op =
> RTE_CRYPTO_OP_TYPE_UNDEFINED;
>
> /**
> --
> 2.25.1
prev parent reply other threads:[~2022-01-28 8:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-25 14:23 Weiguo Li
2022-01-26 13:52 ` Nicolau, Radu
2022-01-28 8:50 ` Zhang, Qi Z [this message]
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=6bed1ee37d76474bbf2a54218734e70a@intel.com \
--to=qi.z.zhang@intel.com \
--cc=dev@dpdk.org \
--cc=jingjing.wu@intel.com \
--cc=liwg06@foxmail.com \
--cc=radu.nicolau@intel.com \
/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).