netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Arnd Bergmann" <arnd@arndb.de>
To: "Pablo Neira Ayuso" <pablo@netfilter.org>,
	"Julian Anastasov" <ja@ssi.bg>
Cc: "Arnd Bergmann" <arnd@kernel.org>,
	"Simon Horman" <horms@verge.net.au>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>,
	"Jiri Wiesner" <jwiesner@suse.de>,
	Netdev <netdev@vger.kernel.org>,
	lvs-devel@vger.kernel.org, netfilter-devel@vger.kernel.org,
	coreteam@netfilter.org,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] ipvs: use div_s64 for signed division
Date: Fri, 16 Dec 2022 12:24:15 +0100	[thread overview]
Message-ID: <e17c7340-8973-417a-a334-01e96e5bbe73@app.fastmail.com> (raw)
In-Reply-To: <Y5xEITNJkry8uy/h@salvia>

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@arndb.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

      reply	other threads:[~2022-12-16 11:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-15 17:03 [PATCH] ipvs: use div_s64 for signed division Arnd Bergmann
2022-12-15 19:01 ` Julian Anastasov
2022-12-16 10:10   ` Pablo Neira Ayuso
2022-12-16 11:24     ` Arnd Bergmann [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e17c7340-8973-417a-a334-01e96e5bbe73@app.fastmail.com \
    --to=arnd@arndb.de \
    --cc=arnd@kernel.org \
    --cc=coreteam@netfilter.org \
    --cc=horms@verge.net.au \
    --cc=ja@ssi.bg \
    --cc=jwiesner@suse.de \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lvs-devel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pablo@netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).