lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 2 Jun 2021 10:10:33 -0700
From:   Jakub Kicinski <kuba@...nel.org>
To:     Saeed Mahameed <saeed@...nel.org>
Cc:     "David S. Miller" <davem@...emloft.net>, netdev@...r.kernel.org,
        Tariq Toukan <tariqt@...dia.com>, Aya Levin <ayal@...dia.com>,
        Saeed Mahameed <saeedm@...dia.com>
Subject: Re: [net 1/8] net/mlx5e: Fix incompatible casting

On Tue,  1 Jun 2021 18:37:16 -0700 Saeed Mahameed wrote:
> From: Aya Levin <ayal@...dia.com>
> 
> Device supports setting of a single fec mode at a time, enforce this
> by bitmap_weight == 1. Input from fec command is in u32, avoid cast to
> unsigned long and use bitmap_from_arr32 to populate bitmap safely.
> 
> Fixes: 4bd9d5070b92 ("net/mlx5e: Enforce setting of a single FEC mode")
> Signed-off-by: Aya Levin <ayal@...dia.com>
> Reviewed-by: Tariq Toukan <tariqt@...dia.com>
> Signed-off-by: Saeed Mahameed <saeedm@...dia.com>
> ---
>  drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
> index 8360289813f0..c4724742eef1 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
> @@ -1624,12 +1624,13 @@ static int mlx5e_set_fecparam(struct net_device *netdev,
>  {
>  	struct mlx5e_priv *priv = netdev_priv(netdev);
>  	struct mlx5_core_dev *mdev = priv->mdev;
> +	unsigned long fec_bitmap;
>  	u16 fec_policy = 0;
>  	int mode;
>  	int err;
>  
> -	if (bitmap_weight((unsigned long *)&fecparam->fec,
> -			  ETHTOOL_FEC_LLRS_BIT + 1) > 1)
> +	bitmap_from_arr32(&fec_bitmap, &fecparam->fec, sizeof(fecparam->fec) * BITS_PER_BYTE);
> +	if (bitmap_weight(&fec_bitmap, ETHTOOL_FEC_LLRS_BIT + 1) > 1)
>  		return -EOPNOTSUPP;
>  
>  	for (mode = 0; mode < ARRAY_SIZE(pplm_fec_2_ethtool); mode++) {

hweight32()? Not that'd be worth a respin

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ