[PATCH v01] net/af_packet: add rollover and defrag options
Gur Stavi
gur.stavi at huawei.com
Wed Oct 30 07:22:16 CET 2024
> > + if (strstr(pair->key, ETH_AF_PACKET_ROLLOVER) != NULL) {
> > + rollover = atoi(pair->value);
> > + if (rollover != 0 && rollover != 1) {
> > + PMD_LOG(ERR,
> > + "%s: invalid rollover value",
> > + name);
> > + return -1;
> > + }
> > + continue;
> > + }
>
> The problem is that atoi() provides little to no error handling.
> Prefer using strtoul() and/or having a common routine for parsing flag
> values.
This block was copy-pasted from the handling of the other options.
I even copied by mistake the indentation error that checkpatch
complained about.
Do you want the atoi to be removed from the old code as well or just
from the new code?
More information about the dev
mailing list