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 F2B2CC30653 for ; Wed, 3 Jul 2024 06:55:49 +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:Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Subject:Cc:To: From:Date:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=+112STnSmnBq9WUzd+MMzssxIWtDa9bVrOCWUEJOUuc=; b=EV/n31z1usrwXSegsN0xicl285 Gsl4Okkkw3ABBwlAH+kueAtQwM/mIakEb22YFzVIwniDKdzpi9VA3KFavymAWktyxmXFA8NVn4Y3h Xcsmw6jYlUwTaxS/OTfc1HaKqaHU29IHkY/CSGrWBBg/EDrO9SLhyYMPnsoswdLBzdrDic0E0jdjB wFCLci4byS7fBfe32WZ7/Y1J/W4GtBe93twC00EdMOP3J38teVY+8+wMrrpXMC1hXgH2TwV4uNShw XO2gZFn8SnEyA5wQCKE4GGsTTNozAXQOQX3TjAzXX0vj5xjuprw43uUAaBoj/JaM/MIkgHKdCH8RA rCa17EqQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sOttx-00000009GHf-0G91; Wed, 03 Jul 2024 06:55:37 +0000 Received: from relay4-d.mail.gandi.net ([2001:4b98:dc4:8::224]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sOttj-00000009GFt-39oi for linux-arm-kernel@lists.infradead.org; Wed, 03 Jul 2024 06:55:25 +0000 Received: by mail.gandi.net (Postfix) with ESMTPSA id 6359BE0005; Wed, 3 Jul 2024 06:55:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1719989718; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+112STnSmnBq9WUzd+MMzssxIWtDa9bVrOCWUEJOUuc=; b=I8fKhS/PeXcxlVYKe8GK5xsSrkRKJFif/5MORW6V/qT3DUtUbQ9kbnfUxbs4tbbS/DJzEV jPFWvgvEggNfffM640DrSbT0+fBra+dREqbHrZL1s7PhHeOvzA+cbriDYePT27AvLxbCj7 dqShxFxthmywaX1xvnXswUsV5D+iOhzHLHD4fc3CbgihqrODEomTMVS8TQ03Nls/1YiRaj 0hIINbX8JRqqt2Vf5TSazRnCf4I2dzk08SaXQP3p58mcqUjzQS6CwkJmhcqtrV03iDnXBk NJvtlrNmJCUffYMxJG9sxt14dS+SlK/CtM06Rm/yl5SlDMh8KtQ+/m5ZCjQZcw== Date: Wed, 3 Jul 2024 08:55:15 +0200 From: Maxime Chevallier To: Simon Horman 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?B?Tmljb2zDsg==?= 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: <20240703085515.25dab47c@fedora-2.home> In-Reply-To: <20240702105411.GF598357@kernel.org> References: <20240701131801.1227740-1-maxime.chevallier@bootlin.com> <20240701131801.1227740-13-maxime.chevallier@bootlin.com> <20240702105411.GF598357@kernel.org> Organization: Bootlin X-Mailer: Claws Mail 4.2.0 (GTK 3.24.41; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-GND-Sasl: maxime.chevallier@bootlin.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240702_235524_135155_05B04F95 X-CRM114-Status: GOOD ( 19.87 ) 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 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 the report, Maxime