netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch net-next] spectrum: acl_tcam: Fix catchall prio value
@ 2017-02-07 14:27 Jiri Pirko
  2017-02-07 14:33 ` David Laight
  0 siblings, 1 reply; 2+ messages in thread
From: Jiri Pirko @ 2017-02-07 14:27 UTC (permalink / raw)
  To: netdev; +Cc: davem, idosch, eladr, mlxsw

From: Jiri Pirko <jiri@mellanox.com>

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

Reported-by: Or Gerlitz <ogerlitz@mellanox.com>
Reported-by: Ido Schimmel <idosch@mellanox.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Fixes: 22a677661f56 ("mlxsw: spectrum: Introduce ACL core with simple TCAM implementation")
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Acked-by: Ido Schimmel <idosch@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c
index a0a968e..1ec3dd0 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c
@@ -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,
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* RE: [patch net-next] spectrum: acl_tcam: Fix catchall prio value
  2017-02-07 14:27 [patch net-next] spectrum: acl_tcam: Fix catchall prio value Jiri Pirko
@ 2017-02-07 14:33 ` David Laight
  0 siblings, 0 replies; 2+ messages in thread
From: David Laight @ 2017-02-07 14:33 UTC (permalink / raw)
  To: 'Jiri Pirko', netdev; +Cc: davem, idosch, eladr, mlxsw

From: Jiri Pirko
> Sent: 07 February 2017 14:27
> From: Jiri Pirko <jiri@mellanox.com>
> 
> This fixes an issue reported by smatch:
> mlxsw_sp_acl_tcam_chunk_create() warn: impossible condition '(priority == (-1)) => (0-u32max ==
> u64max)'
...
> diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c
> b/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c
> index a0a968e..1ec3dd0 100644
> --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c
> +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c
> @@ -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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-02-07 14:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-07 14:27 [patch net-next] spectrum: acl_tcam: Fix catchall prio value Jiri Pirko
2017-02-07 14:33 ` David Laight

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).