From: Li Han <han.li1@zte.com.cn>
To: maryam.tahhan@intel.com
Cc: dev@dpdk.org, Li Han <han.li1@zte.com.cn>
Subject: [dpdk-dev] [PATCH] app/proc-info:fix port mask parse bug
Date: Thu, 27 Sep 2018 03:01:09 -0400 [thread overview]
Message-ID: <1538031669-9305-1-git-send-email-han.li1@zte.com.cn> (raw)
parse_portmask return type is int,but global variable
"enabled_port_mask" type is uint32_t.so in proc_info_parse_args
function,when parse_portmask return -1,"enabled_port_mask" will
get a huge value and "if (enabled_port_mask == 0)" will never happen.
Signed-off-by: Li Han <han.li1@zte.com.cn>
---
app/proc-info/main.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index c20effa..5b06735 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -90,7 +90,7 @@
/*
* Parse the portmask provided at run time.
*/
-static int
+static uint32_t
parse_portmask(const char *portmask)
{
char *end = NULL;
@@ -103,13 +103,10 @@
if ((portmask[0] == '\0') || (end == NULL) || (*end != '\0') ||
(errno != 0)) {
printf("%s ERROR parsing the port mask\n", __func__);
- return -1;
+ return 0;
}
- if (pm == 0)
- return -1;
-
- return pm;
+ return (uint32_t)pm;
}
--
1.8.3.1
next reply other threads:[~2018-09-27 7:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-27 7:01 Li Han [this message]
2018-11-05 11:41 ` Thomas Monjalon
2018-11-05 15:27 ` Pattan, Reshma
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=1538031669-9305-1-git-send-email-han.li1@zte.com.cn \
--to=han.li1@zte.com.cn \
--cc=dev@dpdk.org \
--cc=maryam.tahhan@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).