[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <e17c7340-8973-417a-a334-01e96e5bbe73@app.fastmail.com>
Date: Fri, 16 Dec 2022 12:24:15 +0100
From: "Arnd Bergmann" <arnd@...db.de>
To: "Pablo Neira Ayuso" <pablo@...filter.org>,
"Julian Anastasov" <ja@....bg>
Cc: "Arnd Bergmann" <arnd@...nel.org>,
"Simon Horman" <horms@...ge.net.au>,
"Jakub Kicinski" <kuba@...nel.org>,
"Paolo Abeni" <pabeni@...hat.com>,
"Jiri Wiesner" <jwiesner@...e.de>, Netdev <netdev@...r.kernel.org>,
lvs-devel@...r.kernel.org, netfilter-devel@...r.kernel.org,
coreteam@...filter.org, linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] ipvs: use div_s64 for signed division
On Fri, Dec 16, 2022, at 11:10, Pablo Neira Ayuso wrote:
> Hi Julian,
>
> On Thu, Dec 15, 2022 at 09:01:59PM +0200, Julian Anastasov wrote:
>>
>> Hello,
>>
>> On Thu, 15 Dec 2022, Arnd Bergmann wrote:
>>
>> > From: Arnd Bergmann <arnd@...db.de>
>> >
>> > do_div() is only well-behaved for positive numbers, and now warns
>> > when the first argument is a an s64:
>> >
>> > net/netfilter/ipvs/ip_vs_est.c: In function 'ip_vs_est_calc_limits':
>> > include/asm-generic/div64.h:222:35: error: comparison of distinct pointer types lacks a cast [-Werror]
>> > 222 | (void)(((typeof((n)) *)0) == ((uint64_t *)0)); \
>> > | ^~
>> > net/netfilter/ipvs/ip_vs_est.c:694:17: note: in expansion of macro 'do_div'
>> > 694 | do_div(val, loops);
>>
>> net-next already contains fix for this warning
>> and changes val to u64.
>
> Arnd's patch applies fine on top of net-next, maybe he is addressing
> something else?
No, it's the same bug. I had prepared my patch before the other fix
went in, and only one of the two is needed.
FWIW, I find my version slightly more readable, but Jakub's fix
is probably more efficient, because the unsigned 64-bit division
is better optimized on 32-bit, while div_s64() goes through an
extern function.
Arnd
Powered by blists - more mailing lists