[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a98476cd4414476980a227c0f053bea7@AcuMS.aculab.com>
Date: Sat, 20 Nov 2021 21:57:42 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Bernard Zhao' <bernard@...o.com>, Roopa Prabhu <roopa@...dia.com>,
Nikolay Aleksandrov <nikolay@...dia.com>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
"bridge@...ts.linux-foundation.org"
<bridge@...ts.linux-foundation.org>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] net/bridge: replace simple_strtoul to kstrtol
From: Bernard Zhao
> Sent: 19 November 2021 02:07
>
> simple_strtoull is obsolete, use kstrtol instead.
I think the death announcement of simple_strtoull() has already
been deemed premature.
kstrtol() isn't a replacment in many cases.
> Signed-off-by: Bernard Zhao <bernard@...o.com>
> ---
> net/bridge/br_sysfs_br.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/net/bridge/br_sysfs_br.c b/net/bridge/br_sysfs_br.c
> index d9a89ddd0331..11c490694296 100644
> --- a/net/bridge/br_sysfs_br.c
> +++ b/net/bridge/br_sysfs_br.c
> @@ -36,15 +36,14 @@ static ssize_t store_bridge_parm(struct device *d,
> struct net_bridge *br = to_bridge(d);
> struct netlink_ext_ack extack = {0};
> unsigned long val;
> - char *endp;
> int err;
>
> if (!ns_capable(dev_net(br->dev)->user_ns, CAP_NET_ADMIN))
> return -EPERM;
>
> - val = simple_strtoul(buf, &endp, 0);
> - if (endp == buf)
> - return -EINVAL;
> + err = kstrtoul(buf, 10, &val);
> + if (err != 0)
> + return err;
That changes the valid input strings.
So is a UAPI change.
Now it might be that no one passes in strings that now fail,
but you can't tell.
Rightfully or not it used to ignore any trailing characters.
So "10flobbs" would be treated as "10".
Did you also check what happens to 0x1234 and 012 ?
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Powered by blists - more mailing lists