diff mbox series

[net-next] net: dsa: rtl8366rb: Support all 4096 VLANs

Message ID 20200920203733.409687-1-linus.walleij@linaro.org
State New
Headers show
Series [net-next] net: dsa: rtl8366rb: Support all 4096 VLANs | expand

Commit Message

Linus Walleij Sept. 20, 2020, 8:37 p.m. UTC
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 <linus.walleij@linaro.org>
---
 drivers/net/dsa/rtl8366rb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Florian Fainelli Sept. 20, 2020, 9:06 p.m. UTC | #1
On 9/20/2020 1:37 PM, Linus Walleij wrote:
> 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 <linus.walleij@linaro.org>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
diff mbox series

Patch

diff --git a/drivers/net/dsa/rtl8366rb.c b/drivers/net/dsa/rtl8366rb.c
index 1e79349922f4..1a49ea822b2e 100644
--- a/drivers/net/dsa/rtl8366rb.c
+++ b/drivers/net/dsa/rtl8366rb.c
@@ -1345,7 +1345,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;