Re: mlxsw: spectrum: Introduce ACL core with simple TCAM implementation

From
Colin Ian King <hidden>
Date
2017-02-07 14:15:07
Hi Jiri,

mlxsw_sp_acl_tcam_chunk_create has an issue picked up by static analysis:

 816        struct mlxsw_sp_acl_tcam_chunk *chunk;
 817        int err;
 818
    CID 1400029 (#1 of 1): Operands don't affect result
(CONSTANT_EXPRESSION_RESULT)result_independent_of_operands: priority ==
18446744073709551615UL is always false regardless of the values of its
operands. This occurs as the logical operand of "if".

 819        if (priority == MLXSW_SP_ACL_TCAM_CATCHALL_PRIO)
 820                return ERR_PTR(-EINVAL);
 821

priority is an unsigned int, where as MLXSW_SP_ACL_TCAM_CATCHALL_PRIO is
(-1UL), so the unsigned comparison to a signed long (-1UL) will never be
true. So I think this needs some reworking, especially as
MLXSW_SP_ACL_TCAM_CATCHALL_PRIO priority is being used as an unsigned
long priority in some places, and priority is an unsigned int in other
places of the code.

Colin
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help