net/enic: fix negative array index write
Negative array index write using variable pos as an index to array enic->fdir.nodes. Fixed by add array index check. Coverity issue: 13270 Fixes: fefed3d1e62c ("enic: new driver") Signed-off-by: John Daley <johndale@cisco.com>
This commit is contained in:
parent
6d04eb4c97
commit
4c2c7bf41f
@ -148,9 +148,13 @@ int enic_fdir_add_fltr(struct enic *enic, struct rte_eth_fdir_filter *params)
|
|||||||
enic->fdir.nodes[pos] = NULL;
|
enic->fdir.nodes[pos] = NULL;
|
||||||
if (unlikely(key->rq_index == queue)) {
|
if (unlikely(key->rq_index == queue)) {
|
||||||
/* Nothing to be done */
|
/* Nothing to be done */
|
||||||
pos = rte_hash_add_key(enic->fdir.hash, params);
|
|
||||||
enic->fdir.nodes[pos] = key;
|
|
||||||
enic->fdir.stats.f_add++;
|
enic->fdir.stats.f_add++;
|
||||||
|
pos = rte_hash_add_key(enic->fdir.hash, params);
|
||||||
|
if (pos < 0) {
|
||||||
|
dev_err(enic, "Add hash key failed\n");
|
||||||
|
return pos;
|
||||||
|
}
|
||||||
|
enic->fdir.nodes[pos] = key;
|
||||||
dev_warning(enic,
|
dev_warning(enic,
|
||||||
"FDIR rule is already present\n");
|
"FDIR rule is already present\n");
|
||||||
return 0;
|
return 0;
|
||||||
@ -213,6 +217,11 @@ int enic_fdir_add_fltr(struct enic *enic, struct rte_eth_fdir_filter *params)
|
|||||||
}
|
}
|
||||||
|
|
||||||
pos = rte_hash_add_key(enic->fdir.hash, params);
|
pos = rte_hash_add_key(enic->fdir.hash, params);
|
||||||
|
if (pos < 0) {
|
||||||
|
dev_err(enic, "Add hash key failed\n");
|
||||||
|
return pos;
|
||||||
|
}
|
||||||
|
|
||||||
enic->fdir.nodes[pos] = key;
|
enic->fdir.nodes[pos] = key;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user