generic: ar8216: fix invalid bounds check imported from ChromeOS (FS#347)
The priv->vlan_id member is of size AR8X16_MAX_VLANS, not AR8X16_MAX_PORTS, so check for the proper maximum value in order to avoid capping valid VLAN IDs to 7 (AR8X16_MAX_PORTS - 1). Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
parent
08db3e1b85
commit
29cc927ef5
1 changed files with 1 additions and 1 deletions
|
@ -975,7 +975,7 @@ ar8xxx_sw_set_vid(struct switch_dev *dev, const struct switch_attr *attr,
|
||||||
{
|
{
|
||||||
struct ar8xxx_priv *priv = swdev_to_ar8xxx(dev);
|
struct ar8xxx_priv *priv = swdev_to_ar8xxx(dev);
|
||||||
|
|
||||||
if (val->port_vlan >= AR8X16_MAX_PORTS)
|
if (val->port_vlan >= AR8X16_MAX_VLANS)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
priv->vlan_id[val->port_vlan] = val->value.i;
|
priv->vlan_id[val->port_vlan] = val->value.i;
|
||||||
|
|
Loading…
Reference in a new issue