Skip to content

Commit

Permalink
net: dsa: rtl8366rb: Support all 4096 VLANs
Browse files Browse the repository at this point in the history
[ Upstream commit a7920ef ]

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: d865295 ("net: dsa: realtek-smi: Add Realtek SMI driver")
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
linusw authored and gregkh committed Oct 29, 2020
1 parent a8091e0 commit e06a18b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/dsa/rtl8366rb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1270,7 +1270,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;
Expand Down

0 comments on commit e06a18b

Please sign in to comment.