[dpdk-dev] [PATCH 2/2] eal: fix service core index validity
Min Hu (Connor)
humin29 at huawei.com
Thu Apr 29 04:34:49 CEST 2021
Hi, fixed in v2, thanks.
在 2021/4/21 10:33, Stephen Hemminger 写道:
> On Wed, 21 Apr 2021 09:17:17 +0800
> "Min Hu (Connor)" <humin29 at huawei.com> wrote:
>
>> idx = strtoul(corelist, &end, 10);
>> if (errno || end == NULL)
>> return -1;
>> + if (idx < 0 || idx >= RTE_MAX_LCORE)
>
> Wondered at first how strtoul() could ever return an negative value but then
> noticed that idx is int here.
>
> The code that does would be clearer and safer if the variables were an unsigned
> type. idx, min, max should be the same type everywhere.
>
> Looks like the original code was written in old C style of "all the world's an int"
> .
>
More information about the dev
mailing list