From patchwork Fri Sep 24 23:36:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 514616 Delivered-To: patch@linaro.org Received: by 2002:a17:906:f46:0:0:0:0 with SMTP id h6csp1777584ejj; Fri, 24 Sep 2021 16:39:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx1dRDHFZx26VuoghARpKleseZm9fTFoIUBiEA9RLhzm8qefFpevxF4GQZP3GgOnRz+ng8E X-Received: by 2002:a05:6402:1459:: with SMTP id d25mr8268437edx.78.1632526748884; Fri, 24 Sep 2021 16:39:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632526748; cv=none; d=google.com; s=arc-20160816; b=OnqTc/dXR6+gscJepduLuxVnc1v7ax7HjqFLACSiGZT2b8D8LO/c3EaG4YwY757Aub VVh0AyO6Ddu0fg1eBizfO6RlY9+o1/bJJKcyL2aeJVY93Z3MCDIjqo6DXaBp6ycw5xJ1 PyNgRGIFUUCteEKvNfz1rjP0pIGz7yZwDwQDkSzlE7RV/pRY7//PvzR8uJ/Lc4K3DJP2 6/0+5y4fx7z/bD94cmG0NoZ2RmZSmA10bRc7kDYH8ewbgfEfRC5BrUm3aN7HmgWJJxFF 4DOuojj38TPhUSYJpOpuXHq4RJmf+kwO0MyWVxu+naSOIa1ZGZnvzID6XPQsVl/kPSD7 fWxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=WMsTxrWHhRC1xT+2K/5RB0/0syWqfSvMlujp2wqvh6k=; b=zoL+cjIZolHmIOuZ7MXWkB9BKYfwcSVDApUpHcZ+icxaGvjKWfHF+v/QiNRJLQTyFO hCK/3wmCDCLcEiZSKEA0B+mjRtBFPuUiEu4RIvrDlmN3UnaN+CgF6G7WB4m57mYmSoyI T0zNhvBAmHub03A0NDajWf7MdqhqiJcbUi8uDY9QdOFnUB3BrOwurGzQh2f+dZvC8P9V vETMRyEKY84JxdC45NnpthGCLEEDaNRrMknI+YhdHm3kCKEnxGJ8oShHMRMQkOQlu1Gt G61vibKreicZNh3kZ7Tj36WgJi71lpwhBtWqCodqtj1KMCuVLGNcS6w/mSKSAT+asPAT /skQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XDeHQPoN; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a11si10803843edx.158.2021.09.24.16.39.08; Fri, 24 Sep 2021 16:39:08 -0700 (PDT) Received-SPF: pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XDeHQPoN; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345243AbhIXXkk (ORCPT + 8 others); Fri, 24 Sep 2021 19:40:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51616 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345149AbhIXXka (ORCPT ); Fri, 24 Sep 2021 19:40:30 -0400 Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B14F5C061760 for ; Fri, 24 Sep 2021 16:38:55 -0700 (PDT) Received: by mail-lf1-x12f.google.com with SMTP id u18so45415653lfd.12 for ; Fri, 24 Sep 2021 16:38:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=WMsTxrWHhRC1xT+2K/5RB0/0syWqfSvMlujp2wqvh6k=; b=XDeHQPoN24Et/JFoyMK1/35+aWdPmmX80Maar1VdfEj3YmfR1x35uwbzhYJEfj/Z6Z f8xzBoKnYjmvXsiBEW+67wnpviqPOuGm/qfzKlT/akhgNgCi/AjBxY27BP4GoCTP0q+N xiD7TEA5urE99Fpd/cKdXIIXLf2rRxmRS6BuWgqcjBPXdBB7NxVlHMm/YjEpO0o6XPpq RT4vVnlabWE3iADKcdeOnGxWyGNTfMVmB8fkujRz+BeoZwbvb+q1ec5RKD4whr0SSPf0 kOzIaon6dF46mmKnuwnK1rTWKSLlcmAx06107CjBB2PDC/UF85EOWj6Irp3BjQZGlpEq AwpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WMsTxrWHhRC1xT+2K/5RB0/0syWqfSvMlujp2wqvh6k=; b=Sy4KS50gpoWQtwL5QHJdgbps7G9JhSm6jbG+S1PfT5A61zcwFrHvrTWyiN/rJOF4Sl qKWVxWM/0pjKFXudoFJerTUbCe9WkSLRkVVqN2u8zfbuazrMHvrU8tJDXpGAMAnzooje lOPgYGGJRPxlj5e2yFPTTGtran2s6B748Krzjt7NGUHHR/cD8zSqnrb2i7S3RtZ6q3QI Q6wVRq70DAkGzvt9HlDLqe8BkX9FLbRt37rPUseyUYj4Wyp+2NPt72kazh4bzFhb9lm5 n3Mp0GD/YKheXnyMNP3tC7w2DmP/OiDtvXvKNB072cu5yx2vx3/byp+HONViDzTg07PG cVHQ== X-Gm-Message-State: AOAM5306MGoSLRRk+7uMHLnUXS8Imq3w78P+CvPc4GxsAh0BFJfqPse+ W+QrEIYb9l5cAqFfYaNdYEP8OQ== X-Received: by 2002:a2e:5803:: with SMTP id m3mr13948055ljb.137.1632526734130; Fri, 24 Sep 2021 16:38:54 -0700 (PDT) Received: from localhost.localdomain (c-fdcc225c.014-348-6c756e10.bbcust.telenor.se. [92.34.204.253]) by smtp.gmail.com with ESMTPSA id k21sm1176652lji.81.2021.09.24.16.38.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Sep 2021 16:38:53 -0700 (PDT) From: Linus Walleij To: Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , "David S . Miller" , Jakub Kicinski Cc: netdev@vger.kernel.org, Linus Walleij , Mauri Sandberg , =?utf-8?q?Alvin_=C5=A0ipraga?= , DENG Qingfang Subject: [PATCH net-next 4/6 v5] net: dsa: rtl8366rb: Fix off-by-one bug Date: Sat, 25 Sep 2021 01:36:26 +0200 Message-Id: <20210924233628.2016227-5-linus.walleij@linaro.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210924233628.2016227-1-linus.walleij@linaro.org> References: <20210924233628.2016227-1-linus.walleij@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The max VLAN number with non-4K VLAN activated is 15, and the range is 0..15. Not 16. The impact should be low since we by default have 4K VLAN and thus have 4095 VLANs to play with in this switch. There will not be a problem unless the code is rewritten to only use 16 VLANs. Fixes: d8652956cf37 ("net: dsa: realtek-smi: Add Realtek SMI driver") Cc: Vladimir Oltean Cc: Mauri Sandberg Cc: Alvin Šipraga Cc: DENG Qingfang Cc: Florian Fainelli Signed-off-by: Linus Walleij --- ChangeLog v4->v5: - Add some more text describing that this is not a critical bug. - Add Fixes tag ChangeLog v1->v4: - New patch for a bug discovered when fixing the other issues. --- drivers/net/dsa/rtl8366rb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.31.1 diff --git a/drivers/net/dsa/rtl8366rb.c b/drivers/net/dsa/rtl8366rb.c index 1f228a7a5685..7e57442ab0ca 100644 --- a/drivers/net/dsa/rtl8366rb.c +++ b/drivers/net/dsa/rtl8366rb.c @@ -1451,7 +1451,7 @@ static int rtl8366rb_set_mc_index(struct realtek_smi *smi, int port, int index) static bool rtl8366rb_is_vlan_valid(struct realtek_smi *smi, unsigned int vlan) { - unsigned int max = RTL8366RB_NUM_VLANS; + unsigned int max = RTL8366RB_NUM_VLANS - 1; if (smi->vlan4k_enabled) max = RTL8366RB_NUM_VIDS - 1;