From: Dharmik Thakkar <Dharmik.Thakkar@arm.com>
To: wangyunjian <wangyunjian@huawei.com>
Cc: dev <dev@dpdk.org>,
"yipeng1.wang@intel.com" <yipeng1.wang@intel.com>,
"sameh.gobriel@intel.com" <sameh.gobriel@intel.com>,
"bruce.richardson@intel.com" <bruce.richardson@intel.com>,
"jerry.lilijun@huawei.com" <jerry.lilijun@huawei.com>,
"xudingke@huawei.com" <xudingke@huawei.com>,
"stable@dpdk.org" <stable@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH] hash: fix dereference before null check
Date: Tue, 27 Oct 2020 14:59:04 +0000 [thread overview]
Message-ID: <009D1070-E74E-4D39-93EE-B76A72D9C6AA@arm.com> (raw)
In-Reply-To: <166b4a84232777b5ff3dd5d659140dab104e3f77.1603782481.git.wangyunjian@huawei.com>
Hi Yunjian,
Thank you for fixing the issue!
> On Oct 27, 2020, at 7:51 AM, wangyunjian <wangyunjian@huawei.com> wrote:
>
> From: Yunjian Wang <wangyunjian@huawei.com>
>
> Coverity flags that 'h' variable is used before
> it's checked for NULL. This patch fixes this issue.
>
> Coverity issue: 363625
> Fixes: 769b2de7fb52 ("hash: implement RCU resources reclamation")
> Cc: stable@dpdk.org
>
> Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
> ---
> lib/librte_hash/rte_cuckoo_hash.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/lib/librte_hash/rte_cuckoo_hash.c b/lib/librte_hash/rte_cuckoo_hash.c
> index 7514e33aa9..1191dfd81a 100644
> --- a/lib/librte_hash/rte_cuckoo_hash.c
> +++ b/lib/librte_hash/rte_cuckoo_hash.c
> @@ -1515,15 +1515,16 @@ rte_hash_rcu_qsbr_add(struct rte_hash *h, struct rte_hash_rcu_config *cfg)
> struct rte_rcu_qsbr_dq_parameters params = {0};
> char rcu_dq_name[RTE_RCU_QSBR_DQ_NAMESIZE];
> struct rte_hash_rcu_config *hash_rcu_cfg = NULL;
> -const uint32_t total_entries = h->use_local_cache ?
> -h->entries + (RTE_MAX_LCORE - 1) * (LCORE_CACHE_SIZE - 1) + 1
> -: h->entries + 1;
>
> if (h == NULL || cfg == NULL || cfg->v == NULL) {
> rte_errno = EINVAL;
> return 1;
> }
>
> +const uint32_t total_entries = h->use_local_cache ?
> +h->entries + (RTE_MAX_LCORE - 1) * (LCORE_CACHE_SIZE - 1) + 1
> +: h->entries + 1;
> +
> if (h->hash_rcu_cfg) {
> rte_errno = EEXIST;
> return 1;
> —
> 2.23.0
>
Reviewed-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
next prev parent reply other threads:[~2020-10-27 15:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-27 12:51 wangyunjian
2020-10-27 14:59 ` Dharmik Thakkar [this message]
2020-10-27 15:08 ` Dharmik Thakkar
2020-10-28 16:25 ` Wang, Yipeng1
2020-10-29 16:09 ` [dpdk-dev] [dpdk-stable] " David Marchand
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=009D1070-E74E-4D39-93EE-B76A72D9C6AA@arm.com \
--to=dharmik.thakkar@arm.com \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=jerry.lilijun@huawei.com \
--cc=sameh.gobriel@intel.com \
--cc=stable@dpdk.org \
--cc=wangyunjian@huawei.com \
--cc=xudingke@huawei.com \
--cc=yipeng1.wang@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).