* [dpdk-dev] [PATCH v2] app/proc-info:fix port mask parse bug
@ 2018-11-06 3:04 Li Han
2018-11-06 10:39 ` Pattan, Reshma
0 siblings, 1 reply; 2+ messages in thread
From: Li Han @ 2018-11-06 3:04 UTC (permalink / raw)
To: reshma.pattan; +Cc: dev, Li Han
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>
---
v2:fix typecast issue
---
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..650d599 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -37,7 +37,7 @@
#define MAX_STRING_LEN 256
/**< mask of enabled ports */
-static uint32_t enabled_port_mask;
+static uint64_t enabled_port_mask;
/**< Enable stats. */
static uint32_t enable_stats;
/**< Enable xstats. */
@@ -90,7 +90,7 @@
/*
* Parse the portmask provided at run time.
*/
-static int
+static unsigned long
parse_portmask(const char *portmask)
{
char *end = NULL;
@@ -103,12 +103,9 @@
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;
}
--
1.8.3.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [dpdk-dev] [PATCH v2] app/proc-info:fix port mask parse bug
2018-11-06 3:04 [dpdk-dev] [PATCH v2] app/proc-info:fix port mask parse bug Li Han
@ 2018-11-06 10:39 ` Pattan, Reshma
0 siblings, 0 replies; 2+ messages in thread
From: Pattan, Reshma @ 2018-11-06 10:39 UTC (permalink / raw)
To: Li Han; +Cc: dev
Hi,
> -----Original Message-----
> From: Li Han [mailto:han.li1@zte.com.cn]
> Sent: Tuesday, November 6, 2018 3:04 AM
> To: Pattan, Reshma <reshma.pattan@intel.com>
> Cc: dev@dpdk.org; Li Han <han.li1@zte.com.cn>
> Subject: [PATCH v2] [dpdk-dev] app/proc-info:fix port mask parse bug
>
> 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.
1) Please add Fixes line for the commit id that introduced this bug.
Refer below link to know more on Fixes line, http://doc.dpdk.org/guides/contributing/patches.html
Ex: Fixes: commit id ("commit message")
2) Title of the patch just can be "fix port mask parsing". No need to say bug.
And give space after ': ' in the heading.
When I ran below script after applying your patches above 2 issues been reported, so you should make sure to run the below script before sending the patch.
$devtools/check-git-log.sh
Wrong headline format:
app/proc-info:fix port mask parse bug
Missing 'Fixes' tag:
app/proc-info:fix port mask parse bug
Other than that , Please keep my ack in next version
Acked-by: Reshma Pattan <reshma.pattan@intel.com>
Thanks,
Reshma
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-11-06 10:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-06 3:04 [dpdk-dev] [PATCH v2] app/proc-info:fix port mask parse bug Li Han
2018-11-06 10:39 ` Pattan, Reshma
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).