[PATCH v01] net/af_packet: add rollover and defrag options

Stephen Hemminger stephen at networkplumber.org
Wed Oct 30 15:59:09 CET 2024


On Wed, 30 Oct 2024 08:22:16 +0200
Gur Stavi <gur.stavi at huawei.com> wrote:

> > > +		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?
> 
> 

Lets fix that as another patch later.


More information about the dev mailing list