[dpdk-dev] 答复: Re: [PATCH v3] app/proc-info: fix port mask parse issue

han.li1 at zte.com.cn han.li1 at zte.com.cn
Wed Nov 14 04:57:07 CET 2018


Hi,
  below is maintainer's suggestion,and I think it's ok to do these changes?
> -----Original Message-----> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Li HanTo avoid typecast below , please use uint64_t for enabled_port_mask. So change below function return type to uint64_t> -static int> +static uint32_t>  parse_portmask(const char *portmask)>  {Declare pm to be of type uint64_t.> +	return (uint32_t)pm;You can remove above typecast after change to uint64_t. Thanks, Reshma





------------------原始邮件------------------
发件人:ThomasMonjalon <thomas at monjalon.net>
收件人:韩丽00112882;
抄送人:dev at dpdk.org <dev at dpdk.org>;reshma.pattan at intel.com <reshma.pattan at intel.com>;
日 期 :2018年11月14日 11:10
主 题 :Re: [dpdk-dev] [PATCH v3]  app/proc-info: fix port mask parse issue
Hi,

07/11/2018 07:10, 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.
>
> Fixes: 22561383ea17 ("app: replace dump_cfg by proc_info")
> Signed-off-by: Li Han <han.li1 at zte.com.cn>
[...]
> -static uint32_t enabled_port_mask;
> +static uint64_t enabled_port_mask;
[...]
> -static int
> +static unsigned long
>  parse_portmask(const char *portmask)

On one side, you use uint64_t, on the other side, you use unsigned long.
I don't understand the logic behind.


More information about the dev mailing list