From patchwork Tue Apr 23 10:53:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: linke li X-Patchwork-Id: 13639869 X-Patchwork-Delegate: kuba@kernel.org Received: from out203-205-221-210.mail.qq.com (out203-205-221-210.mail.qq.com [203.205.221.210]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EE1BF80025; Tue, 23 Apr 2024 10:53:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.205.221.210 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713869628; cv=none; b=at721InxfdpbXKm5HsQnOWZh7Zvb646sFFK0vaUgSWPvKb1yEoYbc8eCHWlYsBuHqeD4Cbe+Qlh5cH1cQtEqyth1LyNuyuQ9RVl8NTDeGj8zQrEi1chSrZWlpeQo519lH6aGI1pct4wF1awOoAmhhb6xXRuqA7Xhjflg5DISpQ4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713869628; c=relaxed/simple; bh=LfagOb0pRvs+Yqv+NkD/D22iemaPJwNTcBbHuXvf4k8=; h=Message-ID:From:To:Cc:Subject:Date:MIME-Version; b=agxwq9VRceV3coxRsY+LdzIDgxjkkD7ywJ0HKLdjppG2bI5PFiuXExkqKnLfLY8QeJvXbp9Z6gvNWfZfDqzGjiydgue+hphrHeK8O0F27Uub4UpqxYwe6UB+qJGYxR6knOwmAWaQvRyX4GbdGR1zyQTEZJo8r/x2VzuOKVsGyuE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=qq.com; spf=pass smtp.mailfrom=qq.com; dkim=pass (1024-bit key) header.d=qq.com header.i=@qq.com header.b=y/2sqepl; arc=none smtp.client-ip=203.205.221.210 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=qq.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=qq.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=qq.com header.i=@qq.com header.b="y/2sqepl" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qq.com; s=s201512; t=1713869614; bh=/w5cKHDs6QXVwx078jjgBY94FORPbibvpuN7BzjxfHo=; h=From:To:Cc:Subject:Date; b=y/2sqeplB+bu7L3tw+TuETERVanXv9AcyROe1tzusrsfNcrwNoQMwuoVVWKRkj4Xm CZVFi8LiOFxcTueGUP/eON7oGnnA6Swo8cWKzZXH+kzGg3pVKap9NtEoFCVrE69ETG Sbp5tVDQ6rBvucXj4W6TMTM9xIAFu8UmIOKT5/bM= Received: from localhost.localdomain ([58.213.8.145]) by newxmesmtplogicsvrszb16-1.qq.com (NewEsmtp) with SMTP id D5F99E4A; Tue, 23 Apr 2024 18:53:31 +0800 X-QQ-mid: xmsmtpt1713869611tckeqekqp Message-ID: X-QQ-XMAILINFO: OZZSS56D9fAjxGKrQADUKsNLsZYDLsH2pHwDVVd/MVCsWEdnuuflZeC7gLw1qk bh1E8dear7oI7v3YY95BAz0ITzjU+ytVfSNrFpVo09c8KyR1wxu6L+00AK24qauoVnxdmC3SEphz ssYhtuW82bzVRyFy6Wkd/qkqeQJVXwx54roBdDIG1CxSVSMFnRmhdcxxeqYvOzBJD8WM65w5bEgx TfbkF72SjJsR/CQYhO8VHnGuch0c0WX3jyVFx5gVJR1Hlp1lBJJpsipJh+WFyFQNj6zilqU0LiAc Ya47AVX6l6B85is1Vu7A7Ga9WHoEh2D3XAJUGh3y7H6PdM1o1y9Ai1MdHwep9nV8+g5qKJzPWmUg KuGXepA2eXIydEHj5PuU0/Ify+yzGLfH/VKsWFmKL/FxgKHIS0nSTJVmjfXb1KNWHBSTdDB1UnCv 8DtFwkGSdXG5WPnJCrjRho21RkeRyFuH7l9VddJDz+Ua41wjIXgKxmXHbkRK8h86bbWxTIz4sjlF 1D+ig5Cs6lfNdMJmyWgqX/mI2gjtxr/XI0/7/dcnurW0ksOJuAocwdAO8avU7RQETk62EatJtsBX Y6uzQoaWa1fDWUaGvq4oZS8JMRMUsOy3gRkX1MtkNG5wK0zNibjznQkBRafeZW71UP1Hh9jZ6NBa CkVOLR5qgd0hqq038rSUof3IaItQHPmwN6pGqYkzUgPugER0+rx0LQPlLo2qt+6NCivU2F36ZtTO TyOjsud+Bpqqw9NT5mHcRubbU9sEP3yZD8x0psLXqJ1VI2JqGSIpM1GtNbLTcgPM9ZSCgQYViTa2 vl1uKfccz13JKq1BxZX/cJ1gIRVTBq0/YgCTFglc9m6LY/EFfHZht7yH37VbpKmgcyO0p/fgLVGa PgSFmXNkcT3cQQ2JPMMgeWI5EgOwsDYnPbQuXBMV6KXAin2qjaDFsi/JCWCkNR49xP6KYKfaowzI kKo9rKmVkY6rBIber1gVOTpf48EmszZbeN2u6KXZSc0Q/6SeiVZgu0oYM/LO4lpLgA6SpNTPdrCt vc8GfBMg== X-QQ-XMRINFO: NS+P29fieYNw95Bth2bWPxk= From: linke li To: Cc: xujianhao01@gmail.com, linke li , Roopa Prabhu , Nikolay Aleksandrov , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , bridge@lists.linux.dev, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] net: bridge: remove redundant check of f->dst Date: Tue, 23 Apr 2024 18:53:26 +0800 X-OQ-MSGID: <20240423105327.77484-1-lilinke99@qq.com> X-Mailer: git-send-email 2.39.3 (Apple Git-146) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org In br_fill_forward_path(), f->dst is checked not to be NULL, then immediately read using READ_ONCE and checked again. The first check is useless, so this patch aims to remove the redundant check of f->dst. Signed-off-by: linke li Acked-by: Nikolay Aleksandrov --- net/bridge/br_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c index 65cee0ad3c1b..ae33b30ff87c 100644 --- a/net/bridge/br_device.c +++ b/net/bridge/br_device.c @@ -405,7 +405,7 @@ static int br_fill_forward_path(struct net_device_path_ctx *ctx, br_vlan_fill_forward_path_pvid(br, ctx, path); f = br_fdb_find_rcu(br, ctx->daddr, path->bridge.vlan_id); - if (!f || !f->dst) + if (!f) return -1; dst = READ_ONCE(f->dst);