From patchwork Mon Sep 13 14:42:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 509795 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp669145jao; Mon, 13 Sep 2021 08:34:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyghnhAq4KuA2YoKeVosIOaEQkcEvCc1E7tqgwoXpbU6HpHR7UqUsI4O9i0kux90a2gpE/A X-Received: by 2002:a05:6402:350d:: with SMTP id b13mr13729103edd.1.1631547289116; Mon, 13 Sep 2021 08:34:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631547289; cv=none; d=google.com; s=arc-20160816; b=gR//g83giLG2jZUXYlrn+pByohLgprVUrbk7PGftIvBC6ZB8YfSja2HhqPOXB3b76E KXPfDfqdTS60PQybyHgz7e4u5Ho0bKGuStGkpHQ1u8tNaIDEIP1frhPQrV2l8Spay1KH ZRSNcEtxu9gyInI5KwpgLp6PQR7Ok0Z7rPsJjOK7pZ14ngvLIh3dL+TRgDf3ssSZhRtS YmNVewHBRWZoeAIF90EUp98hWxJ3yYFwVd0tFrz5uHF+J7CAfDgJe49lQGwigUjqVHX6 n0pruuXr2UGl37Z2zHLGQ6IsSqobmuxxKQLiduQ3QSw04QDyjgYsxgMinnFRK9SDRioQ Ru5g== 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=LYtrDDoObxsNg9Qa7tHy5LD0Y+VUcx6GaTlCkfBdhkQ=; b=lN1xRTNbqLqD9/NISO1BlOzXDiTW7Y5zNjgC8tgyL9QTYTzoP/WpeXwVENG+sHPKLL Q1EqC9CNWmvDUE2sdQcBHNJYdp5ZgZ9BFzmYY0I2rVjJawjpRxomN9Ea4r+9Z+eFeddL Npy/9XoGbQvb6q64Hzwp2ZxE02NarTcZ4JS0vzWzZRTPUGO2QKIlRfORxFzGpaaiTe53 SfI8Mss/z8YPPjcVzgAlSgLKGP1XPjT3Ls0ck3ntmVdg8rYB51hverhD0gMsDpcVk68B hdpjjkgkTxfRpHQYpuRV7H34kRDmljUHkSRXZ8NnIvXYVs37O8mNTxUzYGXj+frQXthf DYoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YL6zKWNz; 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 e1si7844974eji.452.2021.09.13.08.34.48; Mon, 13 Sep 2021 08:34:49 -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=YL6zKWNz; 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 S231605AbhIMPf4 (ORCPT + 8 others); Mon, 13 Sep 2021 11:35:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240718AbhIMPfa (ORCPT ); Mon, 13 Sep 2021 11:35:30 -0400 Received: from mail-lf1-x129.google.com (mail-lf1-x129.google.com [IPv6:2a00:1450:4864:20::129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4BB50C12C75A for ; Mon, 13 Sep 2021 07:45:44 -0700 (PDT) Received: by mail-lf1-x129.google.com with SMTP id a4so21636812lfg.8 for ; Mon, 13 Sep 2021 07:45:44 -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=LYtrDDoObxsNg9Qa7tHy5LD0Y+VUcx6GaTlCkfBdhkQ=; b=YL6zKWNz3wU/ISXiZadwLvMF586w0XIR0RTFi2tr9IPTOGvvOrF2Gt+TWW3RuXQvRR eobC2QEIK+DsCqtLcXgf+a2B28zMC5vOP/E0P4f0kvWkvFNfqyDwssQ/USmSfBik5XAH IU8Cys0uNY/eY11UFlDlDCuVsge/sK5iS/QexhK7jJ9ukkFSUMHs/8LlZZBlyJjoFNkh OxCfb6OZQsNXN4U2wm0OeQUy0D/WZHbWIkH+xp1ghf0Im7dWbQlRODEtQroqsLV2tXzC 0DUqU5LVebvRzg04aJ6+6zrZfSYaptMMqrsUF1sJRUvUnjJXHbjCjzmgydVA7GOtKPuG 5n0A== 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=LYtrDDoObxsNg9Qa7tHy5LD0Y+VUcx6GaTlCkfBdhkQ=; b=Xadlf0LmuMpOFmUyjywc1Be6/aJcVk96Sd1nid0D07cCO/zK1X67HsuphLSF1qFGy+ /f2WdGskjfDaDNoVv3EHvZoSOPYKmvS+hc462mdQThCP4oN7cySBuovXUNGlHSzsPc/s s4WVh/mRKw84v5cbPDMfEOPoGQWsaMTFtYV4p2tmv444BqUjLV5Z/bifQnZ/KRmdz80F Wg2/iXPKG3XhOC1QOdyegTmz+a/vSW809PIJUIgP05Wz0ftUd0erJgq4f8vMP7Np/2KP du3qTXRLIsZM9MQZSmZDk5Cr8oSlUHyINKZ8YkWJrwvLESOZHy9EHXfcJjpDILX10yR8 h7Jg== X-Gm-Message-State: AOAM530TnkV0fIPoT0IXDbdKR38X54Eq6mz2HHDD5G5Zoqqk/0Ee3I+J VJkkd0i6B654Pa7T9CW1Vl1kCw== X-Received: by 2002:a05:6512:903:: with SMTP id e3mr7707690lft.668.1631544341227; Mon, 13 Sep 2021 07:45:41 -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 i12sm849825lfb.301.2021.09.13.07.45.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Sep 2021 07:45:40 -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 6/8] net: dsa: rtl8366rb: Fix off-by-one bug Date: Mon, 13 Sep 2021 16:42:58 +0200 Message-Id: <20210913144300.1265143-7-linus.walleij@linaro.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210913144300.1265143-1-linus.walleij@linaro.org> References: <20210913144300.1265143-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. Cc: Vladimir Oltean Cc: Mauri Sandberg Cc: Alvin Šipraga Cc: Florian Fainelli Cc: DENG Qingfang Signed-off-by: Linus Walleij --- 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 6c35e1ed49aa..dfc8ef470972 100644 --- a/drivers/net/dsa/rtl8366rb.c +++ b/drivers/net/dsa/rtl8366rb.c @@ -1456,7 +1456,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;