Skip to contentSkip to conversation

spectrum: acl_tcam: Fix catchall prio value

PATCH Superseded Jiri Pirko 2 participants 2 messages Feb 7, 2017

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Jiri Pirko

author
#0 lore raw

PATCH 1/1 spectrum: acl_tcam: Fix catchall prio value

From: Jiri Pirko <[email protected]>

This fixes an issue reported by smatch:
mlxsw_sp_acl_tcam_chunk_create() warn: impossible condition '(priority == (-1)) => (0-u32max == u64max)'

Fixes 22a677661f56 ("mlxsw: spectrum: Introduce ACL core with simple TCAM implementation")
---
 drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c +1 -1
index a0a968e..1ec3dd0 100644
@@ -561,7 +561,7 @@ mlxsw_sp_acl_tcam_region_entry_remove(struct mlxsw_sp *mlxsw_sp,
 	mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(ptce2), ptce2_pl);
 }
 
-#define MLXSW_SP_ACL_TCAM_CATCHALL_PRIO (-1UL)
+#define MLXSW_SP_ACL_TCAM_CATCHALL_PRIO (-1U)
 
 static int
 mlxsw_sp_acl_tcam_region_catchall_add(struct mlxsw_sp *mlxsw_sp,
Signature · 1 line
2.7.4
#1 lore raw

From: Jiri Pirko

Quoted 6 lines

Sent: 07 February 2017 14:27
From: Jiri Pirko <[email protected]>

This fixes an issue reported by smatch:
mlxsw_sp_acl_tcam_chunk_create() warn: impossible condition '(priority == (-1)) => (0-u32max == u64max)'

...

drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c mlxsw_sp_acl_tcam_region_entry_remove(struct mlxsw_sp *mlxsw_sp, · line 564

Quoted 11 lines
drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c +1 -1
index a0a968e..1ec3dd0 100644
@@ -561,7 +561,7 @@ mlxsw_sp_acl_tcam_region_entry_remove(struct mlxsw_sp *mlxsw_sp,
 	mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(ptce2), ptce2_pl);
 }
 
-#define MLXSW_SP_ACL_TCAM_CATCHALL_PRIO (-1UL)
+#define MLXSW_SP_ACL_TCAM_CATCHALL_PRIO (-1U)

Either (-1) or (~0u) is probably better.

David