From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 62BDFC47083 for ; Wed, 2 Jun 2021 17:10:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 424A961CA2 for ; Wed, 2 Jun 2021 17:10:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229764AbhFBRMT (ORCPT ); Wed, 2 Jun 2021 13:12:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:38608 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229604AbhFBRMR (ORCPT ); Wed, 2 Jun 2021 13:12:17 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 77D0161028; Wed, 2 Jun 2021 17:10:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1622653834; bh=u+W+i+heGBo0X2/7Y5sUYkYNAmcg7PCzOMtS61Lgui4=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=WDBaxHIH+dgbVWsbw/zV7rEAZMUMeVP3f9sBPlit/Sy95rlnIgoJQ50vhl0pIgfrM VXclJnBEQQAMhIklE+uYV0YlB4Vgz8rtEgDs31rJcf5AWdGixNSueNEhXIdHK5zJ1b b/tL3B0cVr96PHXqT3E/DUXWHi06057dwUs/dMWXdsUOvJTHBS1jj3aQw9LYjLOw4b iXk0aZo20Su9QSRZNazvZGyVMDgVMFzwHQrZRHMDXVHuIzMx/psWz60/8T8oQPX391 e1dNsXR9WZU+0FdoEbZconPB4MObTXfZRhxoPKVA7W7FtUOWj7be/dXv2xxJkAidH9 DxBLzEUx3JrzQ== Date: Wed, 2 Jun 2021 10:10:33 -0700 From: Jakub Kicinski To: Saeed Mahameed Cc: "David S. Miller" , netdev@vger.kernel.org, Tariq Toukan , Aya Levin , Saeed Mahameed Subject: Re: [net 1/8] net/mlx5e: Fix incompatible casting Message-ID: <20210602101033.71216ba6@kicinski-fedora-PC1C0HJN.hsd1.ca.comcast.net> In-Reply-To: <20210602013723.1142650-2-saeed@kernel.org> References: <20210602013723.1142650-1-saeed@kernel.org> <20210602013723.1142650-2-saeed@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Tue, 1 Jun 2021 18:37:16 -0700 Saeed Mahameed wrote: > From: Aya Levin > > 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 > Reviewed-by: Tariq Toukan > Signed-off-by: Saeed Mahameed > --- > 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