From patchwork Sat Sep 25 13:23:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 514624 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp2424686jao; Sat, 25 Sep 2021 06:25:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwhufxHI96Jn6RopKbvLTOORblzVjQ6T3zsAUssW/XTVm4FgkZWrbuDSdtPsyfvqrKzpwzo X-Received: by 2002:a17:907:c22:: with SMTP id ga34mr17164375ejc.336.1632576339446; Sat, 25 Sep 2021 06:25:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632576339; cv=none; d=google.com; s=arc-20160816; b=qgx428URw8L1kvBCFCiAWss8EK64uWuKah1w8p/dJoIsVeM7Q1V+pcBueAatkducjw sfxM2iGazzPFnSFzOFds7kN8nk+WFKIb0tMfjsnSOhy5QsP6FVQeHDvbA74bAIfXlAsx zBrzktvKyyzkxhndtMngnBSibvy474GeVXlIVutvcuJY1BHiXgCbWmBDN3UNFzR+G3d3 GHvpbEnnc83WY+q86ImY/SejjTeDvMIU8ap+SE8XTGEF9t/PUUs/8/+qQsiUJB1pHDG4 fA09+jFjQx0pYjpT2GDcdULMIdYPNVW/byfiAw5ZdxthDYj7I0N+DcoCRBRqs3Y+wuzO R1HA== 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=BD8hM3ctAjh5GlIjFT5kwn0LQu6zAedelwfN30DStyE=; b=nVk7snj007yfgLHb6kBDedEUfkG5nxkNUNV0WGXPdR9bgDtaRulctw8sduJ+rmHx64 l3Zwn+jICRa9p5V4pg4GMjI9KvWLaAoPCkShNu/YUlaWByKZmtJhUtbqRwzS9c8v2e7H HSVtL1xYprui55MzlXU9aqNSBNdwpYZ3UL63nPzkMMefwOiOqPxfL81QZ0+yWaiwnKiu MRm8yPjdCG8Jo17/V5qPvzYInhHGb/rSg+7Rs4gsFgf61M3LhdaSy1jDaio4pcB5WVMl KPloZ2RMwdvq9C43EY34Bsv+QPVCk2dowZONu8OBJvMB4xlS55NrRZKvM06ZZDBgEPp5 F67g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=S3QN6jBI; 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 y17si11435416edm.70.2021.09.25.06.25.39; Sat, 25 Sep 2021 06:25:39 -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=S3QN6jBI; 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 S245603AbhIYN1N (ORCPT + 8 others); Sat, 25 Sep 2021 09:27:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60558 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245566AbhIYN1K (ORCPT ); Sat, 25 Sep 2021 09:27:10 -0400 Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC637C061570 for ; Sat, 25 Sep 2021 06:25:35 -0700 (PDT) Received: by mail-lf1-x12e.google.com with SMTP id b20so53231004lfv.3 for ; Sat, 25 Sep 2021 06:25:35 -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=BD8hM3ctAjh5GlIjFT5kwn0LQu6zAedelwfN30DStyE=; b=S3QN6jBIlqVPIXFj/FX9WnbO0Z1q/fs8vGGVrHKWZ2yIVistJmyK5dkhsxPifw4kdJ yeCp1DZ8L4i7d3GRuZ1fciS3D96Q+990huaVPKGIvWptKRwW9TnGCHQBlnZikgfGRa2w Dm/58syukCgxHqwjC1pXHPDM2EEhlh+Isd2JjU6HxHLLziHX74cvGcQsrv0RleXBZgn7 JHd892oi07oxgv5p6yGonERq3NpSq/Y5RxBIgKpVsc2h6Hg0Qn/3sGhbVLlFAH3UfuWt 58QxhuAdpDG+EkFzJCGRU53v+POeMao4RLLWfyMR/oAhRo7X3up7v5i5Tq9Z+WGL+R8f Di/Q== 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=BD8hM3ctAjh5GlIjFT5kwn0LQu6zAedelwfN30DStyE=; b=Pfl+JTmHxPOSZZKOe21MARq/UOwZwNkzpttf5tYsbku6jN0yQvqAb9ahOPYjz8JIGe +iQheVEjVi858JSDCbekcOoAhWtjha//Jvqx1YT9yEJbYcovchxg0O3S2VH6Jz4ZXKjw UAnUet2kZ6dyJlAxpsxSswGiOHmXF+DCv9vlXXWArBXS71YXHjw9ToVTJQLjRv21QCQP ph+naHMDgRRtzEFrvx3yWcYUMgJUY9T1o7ovOKGmQ0tqFjPzfeqJK8s30zzsToLO9HMR vbo1jY1CWhm+pu7RV7aA7oLWUrJkB2Oh339nKTcquzWF4yQlOY7DXkYjsK7dMcUeINBn 0TwQ== X-Gm-Message-State: AOAM5302CjVzrf1Qy4UwNDfeWKLHUGxkH2nftNIGphphRQWp9DM1hhOB 7+Pklzjz8oADt6FSAr67s4D90g== X-Received: by 2002:a05:651c:1146:: with SMTP id h6mr16907217ljo.444.1632576333998; Sat, 25 Sep 2021 06:25:33 -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 y25sm199590ljj.23.2021.09.25.06.25.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Sep 2021 06:25:33 -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 v6] net: dsa: rtl8366rb: Fix off-by-one bug Date: Sat, 25 Sep 2021 15:23:09 +0200 Message-Id: <20210925132311.2040272-5-linus.walleij@linaro.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210925132311.2040272-1-linus.walleij@linaro.org> References: <20210925132311.2040272-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 v5->v6: - No changes just resending with the rest of the patches. 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 Reviewed-by: Alvin Šipraga Reviewed-by: Vladimir Oltean Reviewed-by: Florian Fainelli diff --git a/drivers/net/dsa/rtl8366rb.c b/drivers/net/dsa/rtl8366rb.c index 2c66a0c2ee50..6f25ee57069d 100644 --- a/drivers/net/dsa/rtl8366rb.c +++ b/drivers/net/dsa/rtl8366rb.c @@ -1450,7 +1450,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;