Return-Path: From: David Laight Date: Sat, 20 Nov 2021 21:57:42 +0000 Message-ID: References: <20211119020642.108397-1-bernard@vivo.com> In-Reply-To: <20211119020642.108397-1-bernard@vivo.com> MIME-Version: 1.0 Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Bridge] [PATCH] net/bridge: replace simple_strtoul to kstrtol List-Id: Linux Ethernet Bridging List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: 'Bernard Zhao' , Roopa Prabhu , Nikolay Aleksandrov , "David S. Miller" , Jakub Kicinski , "bridge@lists.linux-foundation.org" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" From: Bernard Zhao > Sent: 19 November 2021 02:07 >=20 > 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 > --- > net/bridge/br_sysfs_br.c | 7 +++---- > 1 file changed, 3 insertions(+), 4 deletions(-) >=20 > 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, > =09struct net_bridge *br =3D to_bridge(d); > =09struct netlink_ext_ack extack =3D {0}; > =09unsigned long val; > -=09char *endp; > =09int err; >=20 > =09if (!ns_capable(dev_net(br->dev)->user_ns, CAP_NET_ADMIN)) > =09=09return -EPERM; >=20 > -=09val =3D simple_strtoul(buf, &endp, 0); > -=09if (endp =3D=3D buf) > -=09=09return -EINVAL; > +=09err =3D kstrtoul(buf, 10, &val); > +=09if (err !=3D 0) > +=09=09return 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 ? =09David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1= PT, UK Registration No: 1397386 (Wales)