mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-25 02:20:52 +07:00
gianfar: Fix overflow check and return value for gfar_get_cls_all()
This function may currently fill one entry beyond the end of the array it is given. It also doesn't return an error code in case it does detect overflow. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
22e83a2926
commit
710778ff87
@ -1669,10 +1669,10 @@ static int gfar_get_cls_all(struct gfar_private *priv,
|
|||||||
u32 i = 0;
|
u32 i = 0;
|
||||||
|
|
||||||
list_for_each_entry(comp, &priv->rx_list.list, list) {
|
list_for_each_entry(comp, &priv->rx_list.list, list) {
|
||||||
if (i <= cmd->rule_cnt) {
|
if (i == cmd->rule_cnt)
|
||||||
rule_locs[i] = comp->fs.location;
|
return -EMSGSIZE;
|
||||||
i++;
|
rule_locs[i] = comp->fs.location;
|
||||||
}
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd->data = MAX_FILER_IDX;
|
cmd->data = MAX_FILER_IDX;
|
||||||
|
Loading…
Reference in New Issue
Block a user