From patchwork Fri Mar 3 21:48:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Hoffmann X-Patchwork-Id: 1751655 X-Patchwork-Delegate: sander@svanheule.net Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=QijH2iGV; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=3e8.eu header.i=@3e8.eu header.a=rsa-sha256 header.s=mail20211217 header.b=ViZ5AyDd; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PT24r4PjGz246Y for ; Sat, 4 Mar 2023 09:02:04 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=6318LIRWzR2UD9LfJKWy73Xzmku0xWFIr3WR5ig4JOM=; b=QijH2iGV3ZZzNe 8NA6nrcjy7KOxsfGLcmRp0rL6G5Sz/hTvJBQ9APuNzhH6yrL8ITgU/EEVKlYBTLepStKd08CwT9I2 XaWI4HNJuVqSrCG57XgUNl859jr27ZlnIjuGwRoBvTlnpkFtuS5Ka6y17DGo4+7h70hlDdaulPReq D85DANuFrZ1oarHIGY/BNihJSprhqBdETeOaXzuviGzCitHyTauHGrSRlkeNEUKuaGNqc+aCkReRt n5u6p9KyZkPzxh0h8RQE9xGTD93VQvVJLxu7b9vLScvJwSWRnVFagHL/+yeWWOAsUAgf/HJyJ3sB4 fKkpeDqB1oA631Q//deg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pYDNd-007cgc-4Z; Fri, 03 Mar 2023 21:55:58 +0000 Received: from srv5.3e8.eu ([2a03:4000:28:8d0::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pYDJ5-007aMG-2O for openwrt-devel@lists.openwrt.org; Fri, 03 Mar 2023 21:51:19 +0000 Received: from localhost.localdomain (p200300c6cf0202a073867d2e443a1890.dip0.t-ipconnect.de [IPv6:2003:c6:cf02:2a0:7386:7d2e:443a:1890]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by srv5.3e8.eu (Postfix) with ESMTPSA id 780C1120D07; Fri, 3 Mar 2023 22:51:01 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=3e8.eu; s=mail20211217; t=1677880261; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fpRPF0XLcU7SreNnS1XjAK1Niyg0mU6DVM48bq72Plo=; b=ViZ5AyDd2kx44xk4zhfQoNx64qQv/e4izQ8BtbNwI4OoRlzsuGBGblgTN24ywZd6xx/ATg WAH1WKYHBOmnQVO61B9wMJUhWv4/UxZfexFQT166aNAWYjoKr/mt6yVzKU9TUifbd8M2vB QhymzhV1K38OULl+GSFtlHSJ+nFSWSSFZNglhzhR0XkqnLb2ObpIksDyILiFB1iv+6JkZv WUKN6zBa5ar6FzbRfwg45B43pmtzlueAbcOhuqucWgN7MUjG0TYHEQ6ZuPmASYivKrKvut 7RTrLhgeLGDpkwzRw64wYEi8g86uQczEuB4eaFPpoI4H+6773V2SvM7Pbjz6jQ== From: Jan Hoffmann To: openwrt-devel@lists.openwrt.org Cc: Sander Vanheule , Jan Hoffmann Subject: [PATCH 2/6] realtek: don't return 0 from rtl83xx_mc_group_alloc on failure Date: Fri, 3 Mar 2023 22:48:42 +0100 Message-Id: <20230303214846.410414-3-jan@3e8.eu> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230303214846.410414-1-jan@3e8.eu> References: <20230303214846.410414-1-jan@3e8.eu> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230303_135115_863650_529071F8 X-CRM114-Status: GOOD ( 15.08 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: This function returns the index of the allocated multicast group entry, so the return value should be negative when no entry was allocated. Fixes: cde31976e375 ("realtek: Add support for Layer 2 Multicast") Signed-off-by: Jan Hoffmann --- Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org This function returns the index of the allocated multicast group entry, so the return value should be negative when no entry was allocated. Fixes: cde31976e375 ("realtek: Add support for Layer 2 Multicast") Signed-off-by: Jan Hoffmann --- I'm not entirely sure about this patch. Seen individually, changing the return code is obviously the right thing to do. However, this entire branch is effectively dead code at the moment, as the only caller already performs the same check before. That check should probably be removed everywhere, as it doesn't really make sense to ignore mdb entries for LAG members. But I haven't tested that yet, because link aggregation is totally broken right now. So a proper cleanup will have to wait until link aggregation itself is fixed (which I'm currently working on). target/linux/realtek/files-5.10/drivers/net/dsa/rtl83xx/dsa.c | 2 +- target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/dsa.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/target/linux/realtek/files-5.10/drivers/net/dsa/rtl83xx/dsa.c b/target/linux/realtek/files-5.10/drivers/net/dsa/rtl83xx/dsa.c index fee63c36faa1..695453a75862 100644 --- a/target/linux/realtek/files-5.10/drivers/net/dsa/rtl83xx/dsa.c +++ b/target/linux/realtek/files-5.10/drivers/net/dsa/rtl83xx/dsa.c @@ -983,7 +983,7 @@ static int rtl83xx_mc_group_alloc(struct rtl838x_switch_priv *priv, int port) if (priv->is_lagmember[port]) { pr_info("%s: %d is lag slave. ignore\n", __func__, port); - return 0; + return -1; } set_bit(mc_group, priv->mc_group_bm); diff --git a/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/dsa.c b/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/dsa.c index f9980ccacee1..09fdc38b55e7 100644 --- a/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/dsa.c +++ b/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/dsa.c @@ -970,7 +970,7 @@ static int rtl83xx_mc_group_alloc(struct rtl838x_switch_priv *priv, int port) if (priv->is_lagmember[port]) { pr_info("%s: %d is lag slave. ignore\n", __func__, port); - return 0; + return -1; } set_bit(mc_group, priv->mc_group_bm);