Skip to content

Commit d550956

Browse files
raed-salemkuba-moo
authored andcommitted
net/mlx5e: Fix wrong bitwise comparison usage in macsec_fs_rx_add_rule function
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: 3b20949 ("net/mlx5e: Add MACsec RX steering rules") Signed-off-by: Raed Salem <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 74573e3 commit d550956

File tree

1 file changed

+1
-1
lines changed
  • drivers/net/ethernet/mellanox/mlx5/core/en_accel

1 file changed

+1
-1
lines changed

drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec_fs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1180,7 +1180,7 @@ macsec_fs_rx_add_rule(struct mlx5e_macsec_fs *macsec_fs,
11801180
rx_rule->rule[0] = rule;
11811181

11821182
/* Rx crypto table without SCI rule */
1183-
if (cpu_to_be64((__force u64)attrs->sci) & ntohs(MACSEC_PORT_ES)) {
1183+
if ((cpu_to_be64((__force u64)attrs->sci) & 0xFFFF) == ntohs(MACSEC_PORT_ES)) {
11841184
memset(spec, 0, sizeof(struct mlx5_flow_spec));
11851185
memset(&dest, 0, sizeof(struct mlx5_flow_destination));
11861186
memset(&flow_act, 0, sizeof(flow_act));

0 commit comments

Comments
 (0)