RE: [bug report] mlxbf_gige: disable RX filters until RX path initialized

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> -----Original Message-----
> From: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> Sent: Saturday, August 17, 2024 2:53 AM
> To: David Thompson <davthompson@xxxxxxxxxx>
> Cc: kernel-janitors@xxxxxxxxxxxxxxx
> Subject: [bug report] mlxbf_gige: disable RX filters until RX path initialized
> 
> Hello David Thompson,
> 
> Commit df934abb185c ("mlxbf_gige: disable RX filters until RX path
> initialized") from Aug 9, 2024 (linux-next), leads to the following Smatch static
> checker warning:
> 
> drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_rx.c:30
> mlxbf_gige_disable_multicast_rx() warn: was expecting a 64 bit value instead of
> '((((1))) << (1))'
> drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_rx.c:54
> mlxbf_gige_disable_mac_rx_filter() warn: was expecting a 64 bit value instead of
> '(((((1))) << (4)) << index)'
> 
> drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_rx.c
>     24 void mlxbf_gige_disable_multicast_rx(struct mlxbf_gige *priv)
>     25 {
>     26         void __iomem *base = priv->base;
>     27         u64 data;
>     28
>     29         data = readq(base + MLXBF_GIGE_RX_MAC_FILTER_GENERAL);
> --> 30         data &= ~MLXBF_GIGE_RX_MAC_FILTER_EN_MULTICAST;
> 
> I don't know what's stored in "data", but it's a type u64.  The type of
> MLXBF_GIGE_RX_MAC_FILTER_EN_MULTICAST is unsigned long.  This means
> that on a 32bit system, the &= will zero out the top 32 bits as well as the
> MULICAST bit.
> Use BIT_ULL() to fix this bug?
> 
>     31         writeq(data, base + MLXBF_GIGE_RX_MAC_FILTER_GENERAL);
>     32 }
> 
> regards,
> dan carpenter

Thanks for the heads-up Dan.

I will review your proposed fix and verify with smatch locally.

- Dave





[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux