[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250904133011.asqvsucdmuktazc4@skbuf>
Date: Thu, 4 Sep 2025 16:30:11 +0300
From: Vladimir Oltean <vladimir.oltean@....com>
To: Wei Fang <wei.fang@....com>
Cc: richardcochran@...il.com, andrew+netdev@...n.ch, davem@...emloft.net,
edumazet@...gle.com, kuba@...nel.org, pabeni@...hat.com,
xiaoning.wang@....com, Frank.Li@....com, yangbo.lu@....com,
christophe.leroy@...roup.eu, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org,
linux-arm-kernel@...ts.infradead.org, imx@...ts.linux.dev
Subject: Re: [PATCH net-next 1/3] ptp: add debugfs interfaces to loop back
the periodic output signal
On Wed, Sep 03, 2025 at 04:37:47PM +0800, Wei Fang wrote:
> + buf[len] = '\0';
> + cnt = sscanf(buf, "%u %d", &index, &enable);
> + if (cnt != 2)
> + return -EINVAL;
> +
> + if (index >= ops->n_per_lp)
> + return -EINVAL;
> +
> + err = ops->perout_loopback(ops, index, enable ? 1 : 0);
Why not just reject other 'enable' values than 1 or 0? You make it
impossible for other values like '2' to be used in the future, if they
are currently treated the same as '1'.
Also, signed 'enable' doesn't make much sense.
> + if (err)
> + return err;
> +
> + return count;
> +}
Powered by blists - more mailing lists