[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f98615d9-a129-d0b0-e444-cb649c14d7ce@nvidia.com>
Date: Mon, 22 Nov 2021 12:17:39 +0200
From: Nikolay Aleksandrov <nikolay@...dia.com>
To: Ido Schimmel <idosch@...sch.org>, Bernard Zhao <bernard@...o.com>
Cc: Roopa Prabhu <roopa@...dia.com>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
bridge@...ts.linux-foundation.org, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] net/bridge: replace simple_strtoul to kstrtol
On 22/11/2021 12:04, Ido Schimmel wrote:
> On Thu, Nov 18, 2021 at 06:06:42PM -0800, Bernard Zhao wrote:
>> simple_strtoull is obsolete, use kstrtol instead.
>>
>> 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);
>
> Base 16 is valid.
>
> Before this patch:
>
> # ip link add name br0 type bridge vlan_filtering 1
> # echo "0x88a8" > /sys/class/net/br0/bridge/vlan_protocol
> # echo $?
> 0
>
> After this patch:
>
> # ip link add name br0 type bridge vlan_filtering 1
> # echo "0x88a8" > /sys/class/net/br0/bridge/vlan_protocol
> bash: echo: write error: Invalid argument
>
Good catch, Bernard please send a revert. Thanks.
Powered by blists - more mailing lists