From: Linus Walleij Date: Sun, 20 Sep 2020 20:37:33 +0000 (+0200) Subject: net: dsa: rtl8366rb: Support all 4096 VLANs X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=a7920efdd86d8a0d74402dbc80ead03b023294ba;p=linux.git net: dsa: rtl8366rb: Support all 4096 VLANs There is an off-by-one error in rtl8366rb_is_vlan_valid() making VLANs 0..4094 valid while it should be 1..4095. Fix it. Fixes: d8652956cf37 ("net: dsa: realtek-smi: Add Realtek SMI driver") Signed-off-by: Linus Walleij Reviewed-by: Florian Fainelli Signed-off-by: David S. Miller --- diff --git a/drivers/net/dsa/rtl8366rb.c b/drivers/net/dsa/rtl8366rb.c index ddc24f5e4123c..a7ceffc2a70b4 100644 --- a/drivers/net/dsa/rtl8366rb.c +++ b/drivers/net/dsa/rtl8366rb.c @@ -1318,7 +1318,7 @@ static bool rtl8366rb_is_vlan_valid(struct realtek_smi *smi, unsigned int vlan) if (smi->vlan4k_enabled) max = RTL8366RB_NUM_VIDS - 1; - if (vlan == 0 || vlan >= max) + if (vlan == 0 || vlan > max) return false; return true;