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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4829AC3A59D for ; Mon, 24 Oct 2022 06:15:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230397AbiJXGPG (ORCPT ); Mon, 24 Oct 2022 02:15:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230230AbiJXGOi (ORCPT ); Mon, 24 Oct 2022 02:14:38 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 42EF560508 for ; Sun, 23 Oct 2022 23:13:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1C554B80E49 for ; Mon, 24 Oct 2022 06:13:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 75DAFC433D7; Mon, 24 Oct 2022 06:13:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1666592024; bh=ea9+mvIPS2DY34sTnpzGry2VsVROAjau+PY83Aj+Rtc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ul1rsUUoxSgtefPKRQLemX6TZw/GnVqjNWCouLWbINcbCXmJvwqAZ+8dkI722JnAZ 5v7W58y2so0Oe86wk57PQcArW9BvFByh2VozjZFONUU4YWIINC7fhJ2h5Ez/8ard8W K+FIa3bGVae1gdeYNucoK6BsVtCxM0Ke8MlbexJjG6WGygO+ZjpqMgGsh5oIO89oWT FyOCcDAt+L1Re3D/F0Zx7FLe73t013oIX7H8jL6obSZPHDaLeltDaw43SavIvV33m1 F58oSaXOitzw0PZL6iI+JDxPfWNiy98A52xzW9aSykO/gVxzJ//FO2ytSHZLtJrE0l Q4ZDngnyd8a3w== From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet Cc: Saeed Mahameed , netdev@vger.kernel.org, Tariq Toukan , Raed Salem Subject: [V2 net 15/16] net/mlx5e: Fix wrong bitwise comparison usage in macsec_fs_rx_add_rule function Date: Mon, 24 Oct 2022 07:12:19 +0100 Message-Id: <20221024061220.81662-16-saeed@kernel.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221024061220.81662-1-saeed@kernel.org> References: <20221024061220.81662-1-saeed@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Raed Salem The cited commit produces a sparse check error of type "sparse: error: restricted __be64 degrades to integer". The offending line wrongly did a bitwise operation between two different storage types one of 64 bit when the other smaller side is 16 bit which caused the above sparse error, furthermore bitwise operation usage here is wrong in the first place as the constant MACSEC_PORT_ES is not a bitwise field. Fix by using the right mask to get the lower 16 bit if the sci number, and use comparison operator '==' instead of bitwise '&' operator. Fixes: 3b20949cb21b ("net/mlx5e: Add MACsec RX steering rules") Signed-off-by: Raed Salem Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec_fs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec_fs.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec_fs.c index 13dc628b988a..1ac0cf04e811 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec_fs.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec_fs.c @@ -1180,7 +1180,7 @@ macsec_fs_rx_add_rule(struct mlx5e_macsec_fs *macsec_fs, rx_rule->rule[0] = rule; /* Rx crypto table without SCI rule */ - if (cpu_to_be64((__force u64)attrs->sci) & ntohs(MACSEC_PORT_ES)) { + if ((cpu_to_be64((__force u64)attrs->sci) & 0xFFFF) == ntohs(MACSEC_PORT_ES)) { memset(spec, 0, sizeof(struct mlx5_flow_spec)); memset(&dest, 0, sizeof(struct mlx5_flow_destination)); memset(&flow_act, 0, sizeof(flow_act)); -- 2.37.3