From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8E7EFC2BD09 for ; Wed, 3 Jul 2024 20:19:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=IXmpN7TErogeTgEdoViC0FwXJDhTblxOadVHD+irtAQ=; b=r0GmrXmkACsZRR5ukSxBsZN8wE uiMyJeu/vuCuPsAVmfhCW+L9bGtWuE+eLrcuMApcJVTqZW+1yuAyyAAC28RYh8/g3xBxRKiHZf6hc dJLMIvC3pX4erlGjzT4xNoucgbQdI6FbA5mfAGzaF6STrnXben8U69aEObQ6B0WJ+7FitkMyB6SqU 1R/5iyGOWQ8iJbTg9PM+WjtysjeRzAb8aDYNGRzX73H7dao+0OHlRQIJc9qWGJ8yoHPkjdZV/ieTe E5xgcBEuu8c9qOSG8XSLBQxaUn54vVo8G507wh/2B9y/imv6tKNTXA5xiCKabHCoWeAkfCeIFbCWv YgdSSPWQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP6Rd-0000000BMm5-0eFc; Wed, 03 Jul 2024 20:19:13 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP6RP-0000000BMjA-21cw for linux-arm-kernel@lists.infradead.org; Wed, 03 Jul 2024 20:19:00 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id DB59F60CBB; Wed, 3 Jul 2024 20:18:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B4D44C2BD10; Wed, 3 Jul 2024 20:18:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1720037938; bh=NmYwylI9uTS15vLUegAQNWv7+xerEXTc6gEmecROmWE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=s4/r5DBuudtOWa6WnckEwJ48PEJOPiZgE8udE1gQgCFivvL5Ae6CS/INNuKk3a7kP u/1Y9+DraoB1FS/2XVFe8m6KVg5P3OHl4eqMh67cppHHVhecEGlc2DHZxsD82nxmt3 MjXNLuNK8B6p0ujksS0DR7gOrlcIazo+MR5FGILqPP54TuJI4DkhzaPqG47mL11clS 1mBvWQOkYbijMfpDKMTxH8h+s2kceCdwPxApx0QNZgCPUfNwhfw0rnaccA/R9588+T xsEOhDfKH709KzaGS8aXKsmoOXf3gOFS5UTHS+MO+4JqPWGHgWnzwD9RzOTH2OI8x9 AxkVGtBg+18gQ== Date: Wed, 3 Jul 2024 21:18:51 +0100 From: Simon Horman To: Maxime Chevallier Cc: davem@davemloft.net, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, thomas.petazzoni@bootlin.com, Andrew Lunn , Jakub Kicinski , Eric Dumazet , Paolo Abeni , Russell King , linux-arm-kernel@lists.infradead.org, Christophe Leroy , Herve Codina , Florian Fainelli , Heiner Kallweit , Vladimir Oltean , =?utf-8?B?S8O2cnk=?= Maincent , Jesse Brandeburg , Marek =?utf-8?B?QmVow7pu?= , Piergiorgio Beruto , Oleksij Rempel , =?utf-8?Q?Nicol=C3=B2?= Veronese , mwojtas@chromium.org, Nathan Chancellor , Antoine Tenart , Marc Kleine-Budde Subject: Re: [PATCH net-next v14 12/13] net: ethtool: strset: Allow querying phy stats by index Message-ID: <20240703201851.GT598357@kernel.org> References: <20240701131801.1227740-1-maxime.chevallier@bootlin.com> <20240701131801.1227740-13-maxime.chevallier@bootlin.com> <20240702105411.GF598357@kernel.org> <20240703085515.25dab47c@fedora-2.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240703085515.25dab47c@fedora-2.home> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240703_131859_622175_636D5ECD X-CRM114-Status: GOOD ( 25.08 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Jul 03, 2024 at 08:55:15AM +0200, Maxime Chevallier wrote: > Hello Simon, > > On Tue, 2 Jul 2024 11:54:11 +0100 > Simon Horman wrote: > > > On Mon, Jul 01, 2024 at 03:17:58PM +0200, Maxime Chevallier wrote: > > > The ETH_SS_PHY_STATS command gets PHY statistics. Use the phydev pointer > > > from the ethnl request to allow query phy stats from each PHY on the > > > link. > > > > > > Signed-off-by: Maxime Chevallier > > > --- > > > net/ethtool/strset.c | 24 +++++++++++++++++------- > > > 1 file changed, 17 insertions(+), 7 deletions(-) > > > > > > diff --git a/net/ethtool/strset.c b/net/ethtool/strset.c > > > > ... > > > > > @@ -279,6 +280,8 @@ static int strset_prepare_data(const struct ethnl_req_info *req_base, > > > const struct strset_req_info *req_info = STRSET_REQINFO(req_base); > > > struct strset_reply_data *data = STRSET_REPDATA(reply_base); > > > struct net_device *dev = reply_base->dev; > > > + struct nlattr **tb = info->attrs; > > > > Hi Maxime, > > > > Elsewhere in this function it is assumed that info may be NULL. > > But here it is dereferenced unconditionally. > > Hmm in almst all netlink commands we do dereference the genl_info *info > pointer without checks. > > I've looked into net/netlink/genetlink.c to backtrack call-sites and it > looks to be that indeed info can't be NULL (either populated from > genl_start() or genl_family_rcv_msg_doit(). Maybe Jakub can confirm > this ? > > If what I say above is correct, I can include a small patch to remove > the un-necessary check that makes smatch think the genl_info pointer can > be NULL. Thanks for following up. Assuming that is true (I did not check yet) then I agree. And I don't think such a change needs to block this patchset.