Subject: Re: [PATCH net] net: pse-pd: tps23881: Fix boolean evaluation for bitmask checks

From: Simon Horman <[email-masked]>
Date: Tue, 24 Sep 2024 09:26:12 +0100

On Tue, Sep 24, 2024 at 10:15:29AM +0200, Kory Maincent wrote:
> On Tue, 24 Sep 2024 08:18:39 +0100
> Simon Horman <[email-masked]> 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. :)

Right, no question from my side that this change is a good one.
I'm just wondering if it is best for net or net-next.