[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241002170047.2b28e740@kmaincent-XPS-13-7390>
Date: Wed, 2 Oct 2024 17:00:47 +0200
From: Kory Maincent <kory.maincent@...tlin.com>
To: Jakub Kicinski <kuba@...nel.org>
Cc: netdev@...r.kernel.org, linux-kernel@...r.kernel.org, Kyle Swenson
<kyle.swenson@....tech>, Simon Horman <horms@...nel.org>, Oleksij Rempel
<o.rempel@...gutronix.de>, thomas.petazzoni@...tlin.com, "David S. Miller"
<davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, Paolo Abeni
<pabeni@...hat.com>
Subject: Re: [PATCH net v2] net: pse-pd: tps23881: Fix boolean evaluation
for bitmask checks
On Wed, 2 Oct 2024 07:31:56 -0700
Jakub Kicinski <kuba@...nel.org> wrote:
> On Wed, 2 Oct 2024 14:53:02 +0200 Kory Maincent wrote:
> > On Wed, 2 Oct 2024 05:27:32 -0700
> > Jakub Kicinski <kuba@...nel.org> wrote:
> >
> > > On Wed, 2 Oct 2024 05:24:31 -0700 Jakub Kicinski wrote:
> [...]
> [...]
> [...]
> > >
> > > Reading the discussion on v1 it seems you're doing this to be safe,
> > > because there was a problem with x &= val & MASK; elsewhere.
> > > If that's the case, please resend to net-next and make it clear it's
> > > not a fix.
> >
> > Indeed it fixes this issue.
>
> Is "this" here the &= issue or the sentence from the commit message?
>
> > Why do you prefer to have it on net-next instead of a net? We agreed with
> > Oleksij that it's where it should land. Do we have missed something?
>
> The patch is a noop, AFAICT. Are you saying it changes how the code
> behaves?
>
> The patch only coverts cases which are
>
> ena = val & MASK;
>
> the automatic type conversion will turn this into:
>
> ena = bool(val & MASK);
> which is the same as:
> ena = !!(val & MASK);
>
> The problem you were seeing earlier was that:
>
> ena &= val & MASK;
>
> will be converted to:
>
> ena = ena & (val & MASK);
>
> and that is:
>
> ena = bool(int(ena) & (val & MASK));
> ^^^
>
> IOW ena gets promoted to int for the & operation.
> This problem does not occur with simple assignment.
Indeed you are totally right! It is a noop! Thanks!
Should I drop it?
Regards,
--
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com
Powered by blists - more mailing lists