提交 710778ff 编写于 作者: B Ben Hutchings 提交者: David S. Miller

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: NBen Hutchings <bhutchings@solarflare.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 22e83a29
......@@ -1669,10 +1669,10 @@ static int gfar_get_cls_all(struct gfar_private *priv,
u32 i = 0;
list_for_each_entry(comp, &priv->rx_list.list, list) {
if (i <= cmd->rule_cnt) {
rule_locs[i] = comp->fs.location;
i++;
}
if (i == cmd->rule_cnt)
return -EMSGSIZE;
rule_locs[i] = comp->fs.location;
i++;
}
cmd->data = MAX_FILER_IDX;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册