All of lore.kernel.org
 help / color / mirror / Atom feed
From: Weiguo Li <liwg06@foxmail.com>
To: dev@dpdk.org
Cc: stable@dpdk.org, Weiguo Li <liweiguo@xencore.cn>
Subject: [PATCH] devargs: fix derefrence before null test
Date: Mon, 30 Oct 2023 19:45:29 +0800	[thread overview]
Message-ID: <tencent_CF44B0629A79704E5F22C0749CBFED469809@qq.com> (raw)

Pointer 'da' was dereferenced and then compared to NULL,
reorder the code to keep the logic consistent.

Fixes: 4969f5914c9e ("devargs: introduce new parsing helper")
Cc: stable@dpdk.org

Signed-off-by: Weiguo Li <liweiguo@xencore.cn>
---
 .mailmap                            | 2 +-
 lib/eal/common/eal_common_devargs.c | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/.mailmap b/.mailmap
index 3f5bab26a8..b4f0ae26b8 100644
--- a/.mailmap
+++ b/.mailmap
@@ -1500,7 +1500,7 @@ Waterman Cao <waterman.cao@intel.com>
 Weichun Chen <weichunx.chen@intel.com>
 Wei Dai <wei.dai@intel.com>
 Weifeng Li <liweifeng96@126.com>
-Weiguo Li <liwg06@foxmail.com>
+Weiguo Li <liwg06@foxmail.com> <liweiguo@xencore.cn>
 Wei Huang <wei.huang@intel.com>
 Wei Hu <weh@microsoft.com>
 Wei Hu (Xavier) <xavier.huwei@huawei.com>
diff --git a/lib/eal/common/eal_common_devargs.c b/lib/eal/common/eal_common_devargs.c
index fb5d0a293b..8d6c3938eb 100644
--- a/lib/eal/common/eal_common_devargs.c
+++ b/lib/eal/common/eal_common_devargs.c
@@ -185,11 +185,13 @@ rte_devargs_parse(struct rte_devargs *da, const char *dev)
 {
 	struct rte_bus *bus = NULL;
 	const char *devname;
-	const size_t maxlen = sizeof(da->name);
 	size_t i;
 
 	if (da == NULL)
 		return -EINVAL;
+
+	const size_t maxlen = sizeof(da->name);
+
 	memset(da, 0, sizeof(*da));
 
 	/* First parse according global device syntax. */
-- 
2.34.1


             reply	other threads:[~2023-10-30 11:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-30 11:45 Weiguo Li [this message]
2023-10-30 16:24 ` [PATCH] devargs: fix derefrence before null test 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_CF44B0629A79704E5F22C0749CBFED469809@qq.com \
    --to=liwg06@foxmail.com \
    --cc=dev@dpdk.org \
    --cc=liweiguo@xencore.cn \
    --cc=stable@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.