Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 710778ff authored by Ben Hutchings's avatar Ben Hutchings Committed by David S. Miller
Browse files

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: default avatarBen Hutchings <bhutchings@solarflare.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 22e83a29
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -1669,11 +1669,11 @@ 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) {
		if (i == cmd->rule_cnt)
			return -EMSGSIZE;
		rule_locs[i] = comp->fs.location;
		i++;
	}
	}

	cmd->data = MAX_FILER_IDX;