Re: [PATCH net] net: pse-pd: tps23881: Fix boolean evaluation for bitmask checks
From: Kory Maincent
Date: Tue Sep 24 2024 - 04:15:44 EST
On Tue, 24 Sep 2024 08:18:39 +0100
Simon Horman <horms@xxxxxxxxxx> wrote:
> On Mon, Sep 23, 2024 at 05:34:26PM +0200, Kory Maincent wrote:
> [...]
>
> Thanks Kory,
>
> I agree that these changes are correct.
> But are they fixes; can this manifest in a bug?
I didn't face it but I think yes.
In case of a 4 pairs PoE ports without the fix:
chan = priv->port[id].chan[0];
if (chan < 4) {
enabled = ret & BIT(chan);
delivering = ret & BIT(chan + 4);
...
}
if (priv->port[id].is_4p) {
chan = priv->port[id].chan[1];
if (chan < 4) {
enabled &= !!(ret & BIT(chan));
delivering &= !!(ret & BIT(chan + 4));
If enabled = 0x2 here, enabled would be assigned to 0 instead of 1.
...
}
}
I have an issue using 4pairs PoE port with my board so I can't test it.
> (If so, I suspect the Kernel is riddled with such bugs.)
Don't know about it but if I can remove it from my driver it would be nice. :)
Regards,
--
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com