mirror of https://gitee.com/openkylin/linux.git
net: mvpp2: cls: fix less than zero check on a u32 variable
The signed return from the call to mvpp2_cls_c2_port_flow_index is being
assigned to the u32 variable c2.index and then checked for a negative
error condition which is always going to be false. Fix this by assigning
the return to the int variable index and checking this instead.
Addresses-Coverity: ("Unsigned compared against 0")
Fixes: 90b509b39a
("net: mvpp2: cls: Add Classification offload support")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
a97f4fe6e1
commit
d4ee7f195e
|
@ -1029,12 +1029,14 @@ static int mvpp2_port_c2_tcam_rule_add(struct mvpp2_port *port,
|
|||
struct flow_action_entry *act;
|
||||
struct mvpp2_cls_c2_entry c2;
|
||||
u8 qh, ql, pmap;
|
||||
int index;
|
||||
|
||||
memset(&c2, 0, sizeof(c2));
|
||||
|
||||
c2.index = mvpp2_cls_c2_port_flow_index(port, rule->loc);
|
||||
if (c2.index < 0)
|
||||
index = mvpp2_cls_c2_port_flow_index(port, rule->loc);
|
||||
if (index < 0)
|
||||
return -EINVAL;
|
||||
c2.index = index;
|
||||
|
||||
act = &rule->flow->action.entries[0];
|
||||
|
||||
|
|
Loading…
Reference in New Issue