mlxsw: spectrum: Introduce ACL core with simple TCAM implementation
Hello Jiri Pirko,
The patch 22a677661f56: "mlxsw: spectrum: Introduce ACL core with simple TCAM implementation" from Feb 3, 2017, leads to the following static checker warning:
drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c:819 mlxsw_sp_acl_tcam_chunk_create() warn: impossible condition '(priority = (-1)) => (0-u32max = u64max)'
drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c
810 static struct mlxsw_sp_acl_tcam_chunk *
811 mlxsw_sp_acl_tcam_chunk_create(struct mlxsw_sp *mlxsw_sp,
812 struct mlxsw_sp_acl_tcam_group *group,
813 unsigned int priority,
^^^^^^^^^^^^^^^^^^^^^
This should probably be changed to unsigned long?
814 struct mlxsw_afk_element_usage *elusage)
815 {
816 struct mlxsw_sp_acl_tcam_chunk *chunk;
817 int err;
818
819 if (priority = MLXSW_SP_ACL_TCAM_CATCHALL_PRIO)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UINT_MAX != ULONG_MAX on 64 bit systems.
820 return ERR_PTR(-EINVAL); 821 822 chunk = kzalloc(sizeof(*chunk), GFP_KERNEL); 823 if (!chunk) 824 return ERR_PTR(-ENOMEM); 825 chunk->priority = priority; 826 chunk->group = group; 827 chunk->ref_count = 1; 828
regards,
dan carpenter
Quoted 8 lines · Tue, Feb 07, 2017 at 12:01:26PM CET, [email protected] wrote:
Hello Jiri Pirko,
The patch
22a677661f56: "mlxsw: spectrum: Introduce ACL core with simple TCAM implementation" from Feb 3, 2017, leads to the following static checker warning:drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c:819 mlxsw_sp_acl_tcam_chunk_create() warn: impossible condition '(priority = (-1)) => (0-u32max = u64max)'
Thanks, I already have fix for this queued-up.
Quoted 31 lines
drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c
810 static structmlxsw_sp_acl_tcam_chunk*
811 mlxsw_sp_acl_tcam_chunk_create(structmlxsw_sp*mlxsw_sp,
812 structmlxsw_sp_acl_tcam_group*group,
813 unsigned int priority,^^^^^^^^^^^^^^^^^^^^^This should probably be changed to unsigned long?
814 struct
mlxsw_afk_element_usage*elusage)
815 {
816 structmlxsw_sp_acl_tcam_chunk*chunk;
817 int err;
818
819 if (priority =MLXSW_SP_ACL_TCAM_CATCHALL_PRIO)^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UINT_MAX!=ULONG_MAXon 64 bit systems.820 return ERR_PTR(-EINVAL); 821 822 chunk = kzalloc(sizeof(*chunk), GFP_KERNEL); 823 if (!chunk) 824 return ERR_PTR(-ENOMEM); 825 chunk->priority = priority; 826 chunk->group = group; 827 chunk->ref_count = 1; 828regards,
dan carpenter