net: dsa: b53: fix an off by one in checking "vlan->vid"
authorDan Carpenter <dan.carpenter@oracle.com>
Tue, 19 Jan 2021 14:48:03 +0000 (17:48 +0300)
committerJakub Kicinski <kuba@kernel.org>
Wed, 20 Jan 2021 03:34:49 +0000 (19:34 -0800)
commit8e4052c32d6b4b39c1e13c652c7e33748d447409
tree716a26084f94a0594cbb8736ee9cbd221f8ee904
parentb160c28548bc0a87cbd16d5af6d3edcfd70b8c9a
net: dsa: b53: fix an off by one in checking "vlan->vid"

The > comparison should be >= to prevent accessing one element beyond
the end of the dev->vlans[] array in the caller function, b53_vlan_add().
The "dev->vlans" array is allocated in the b53_switch_init() function
and it has "dev->num_vlans" elements.

Fixes: a2482d2ce349 ("net: dsa: b53: Plug in VLAN support")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Link: https://lore.kernel.org/r/YAbxI97Dl/pmBy5V@mwanda
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/dsa/b53/b53_common.c