From patchwork Tue Oct 27 13:49:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 307225 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E0B0BC56202 for ; Tue, 27 Oct 2020 17:02:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 97DCF218AC for ; Tue, 27 Oct 2020 17:02:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603818156; bh=ebXNB9nP+ifo2uY51WTMYq4sbNc7d8Z2vU0Dfu2fcRU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=p+GBVLtbU2Yn3LjyWy9vwuxaYUmuCatyV8bjxhw5rKFH0RArhENKB2klNVUntiGFo RQYQOSxOSfhhK7RM66cM7UiG7ECDAbOGZKg0rJnGZnPnMFgt1Wwor5kgbLoCYoePVH l539cfNY/1x5Nv/ZiNRNFLnqb3Vaig3KRgqr6pAA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1793718AbgJ0PH7 (ORCPT ); Tue, 27 Oct 2020 11:07:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:34074 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750872AbgJ0PAn (ORCPT ); Tue, 27 Oct 2020 11:00:43 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B5C922231B; Tue, 27 Oct 2020 15:00:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603810843; bh=ebXNB9nP+ifo2uY51WTMYq4sbNc7d8Z2vU0Dfu2fcRU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bpGkcXuCR4T0PzcfMkAfO8+SPGA2/lNq7+m8cn1An2cz2sMQbq4xlYN5nrSHcw+vW /xiY1j9twF9ZavGOvq8EjO/aTgU0zNr49XM2T+lW7dXltXd8QUZ38e/VkbJCzhsbqV hG4Q0BRupsgCDXwIorfZVh1+UdyRFXMDvI08n19g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Linus Walleij , Florian Fainelli , "David S. Miller" , Sasha Levin Subject: [PATCH 5.8 251/633] net: dsa: rtl8366rb: Support all 4096 VLANs Date: Tue, 27 Oct 2020 14:49:54 +0100 Message-Id: <20201027135534.451397872@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135522.655719020@linuxfoundation.org> References: <20201027135522.655719020@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Linus Walleij [ Upstream commit a7920efdd86d8a0d74402dbc80ead03b023294ba ] 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 Signed-off-by: Sasha Levin --- drivers/net/dsa/rtl8366rb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/dsa/rtl8366rb.c b/drivers/net/dsa/rtl8366rb.c index fd1977590cb4b..c83b332656a4b 100644 --- a/drivers/net/dsa/rtl8366rb.c +++ b/drivers/net/dsa/rtl8366rb.c @@ -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;