Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp1018102lqo; Fri, 17 May 2024 08:21:37 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU9bpYeMwCX7DvUTR7qu8DX0w9iBHtYC0JKcLhHM3HlU/BQIdWW9pogAGOJbmCaO2tAoRlcNEN12xFtBKGPVHNXkaUERkLVHIVags4dFw== X-Google-Smtp-Source: AGHT+IG89faCRCWL2JvZfkANetcP36RxcADu3EhV1cw2qOwHMBbwjDCtEO/mzpLJ/uQYX1b8mSjP X-Received: by 2002:a17:907:9405:b0:a5a:542d:ae0a with SMTP id a640c23a62f3a-a5a542daf06mr1546030366b.63.1715959297615; Fri, 17 May 2024 08:21:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715959297; cv=pass; d=google.com; s=arc-20160816; b=r1FjDMtRdm7WVJTASnvfQJzYz6mIWvo9lNajrG12iEDw2FTUAK5ZCdTEGBxzRUK8Ck zK7Ckp3d9Dz/FWEXx7J79IYMB5Cdt6m4hX6F5IKnJnu2G3Ar38LmCcVhMq4N5j2hbDHl aIsjcaVpQAbPGjLIq6G41UA4ZTCaHeU1JD+wFheFmDmv8MKSc9foG0ME3R0e38zvwa// DKnH2AgqvaffkcEBSdf6iDOrItAceQ0UG0kQC1wptEUfEJ+fIOdLZhRY9rty88/eh8S7 ix35ijb643lmHH/WnlEO+TjJeITWY/yAnqLQTu1UDgczuVTPpAsX3szW8U+cmQM3D6XW HPtQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:organization:references :in-reply-to:message-id:subject:cc:to:from:date:dkim-signature; bh=AeTxGtF/EgpBohuFwBuKpus55RrUZBrBwjxJhjj16pM=; fh=GL1Lry0UPN+7A+nzZ7p3nPcyqPuXRdNbibT8GljqcXk=; b=gHncVzrBK7ZSdjuoKy9/Hta9LYXkIviU5uZsedLscvvY+vgwyRUzAD0aTKWuLC9WFZ 8Ujve4ocgHLTty85BqPzchSltkI70XNQ1kNypZe0T7LmUObuy4bnKqk2ei11SXrK5WBT PSHbt3b09t0tybatvuxnF6p2fIlj0qizgNCzt7VhOIyBkRY9eNCpaXDom05gCl1oFsDH otUezHjOvd0HoNGMlHiApOC2Sr3/A4FVxlRGK30cPFSGbY0jLEbRRl2jM6MpZ93006GA K7xdVVWAQ0FGh4oYwfZbXXZQpBt2PyCYbk99q2zMU2FIfQ2hmhNZwE5kT5fBKi6E8MIJ U3Jw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=LwnM3V7e; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-182287-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-182287-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a5cdff321e6si243294966b.472.2024.05.17.08.21.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 May 2024 08:21:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-182287-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=LwnM3V7e; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-182287-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-182287-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 4F1341F221B5 for ; Fri, 17 May 2024 15:21:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 638D912DD8C; Fri, 17 May 2024 15:21:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="LwnM3V7e" Received: from mslow1.mail.gandi.net (mslow1.mail.gandi.net [217.70.178.240]) (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 988E212D77C; Fri, 17 May 2024 15:21:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.178.240 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715959282; cv=none; b=PMwhTVG/W2UYCRrxUSoW6gC/K4ggkayemIzOmVvVUU5M/KNgMC2hiIoCpk++b4fuBF5lLAjCrwIq1RhrjpHOclEzwoMxfh0CgD+9TCuWORskmISZPlXGnpDxG00THFu5bFIR+MJUTGmv3JPdOZ8irY/10bNhWBNCWarw9WCgysQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715959282; c=relaxed/simple; bh=wOMTQcCv4RXt7oOImw1VgaZvQGn5ykZzqAP4bE+CoMU=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=GBcXrKDLEb0ejP2Qq9GmlCClZLuGesiwuhvmoobFJ1iguqRGZp2dbEk1WghVjkhMYE3Vst8q8uQOsa2lZQh1UWdXtHt531KjAfD27K/4ouMRgCrwOaFAmQ+XboK2aUJ950OAcWvcytTyyjOphpvHRy9dFgCBHz/8DGQv2IjTCWU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=LwnM3V7e; arc=none smtp.client-ip=217.70.178.240 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Received: from relay4-d.mail.gandi.net (unknown [IPv6:2001:4b98:dc4:8::224]) by mslow1.mail.gandi.net (Postfix) with ESMTP id 35ED8C3359; Fri, 17 May 2024 15:13:06 +0000 (UTC) Received: by mail.gandi.net (Postfix) with ESMTPSA id 1B596E0006; Fri, 17 May 2024 15:12:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1715958778; 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=AeTxGtF/EgpBohuFwBuKpus55RrUZBrBwjxJhjj16pM=; b=LwnM3V7eJkdBSvC60vIBB/gpmPTBTg45+MHoX5J3y8e6MIDgjtuDAaAZJ8PO2C/IkLxcT7 dgYAigX8S8JnySY+TiK9KFRyJ6asu9Vr9N/2FCiaz+xr0LPFBi76HAX4kqY50rxRcjf97D A8kKU94tWLDMIy6Ey/QDQfO93fYSp5Hq7pqCKrKJtymojYj/tuG6J7U3mhyLW8JBzWDXux bCtkutz/3IvYXnPvFFAIygoP3SvO5+iupK52xZyOdetxcgIw7p2g33CRPx59cdGfUOspqN SZnpVfQ+i8F1qBDKJIKM9OJN6ho4rPhKDmk/fnQC6OIJ5LRkaY9o/f7ry0mhtg== Date: Fri, 17 May 2024 17:12:54 +0200 From: Kory Maincent To: Simon Horman Cc: Florian Fainelli , Broadcom internal kernel review list , Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Richard Cochran , Radu Pirea , Jay Vosburgh , Andy Gospodarek , Nicolas Ferre , Claudiu Beznea , Willem de Bruijn , Jonathan Corbet , Horatiu Vultur , UNGLinuxDriver@microchip.com, Vladimir Oltean , Thomas Petazzoni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, Maxime Chevallier , Rahul Rameshbabu Subject: Re: [PATCH net-next v12 12/13] net: ethtool: tsinfo: Add support for hwtstamp provider and get/set hwtstamp config Message-ID: <20240517171254.1e316e69@kmaincent-XPS-13-7390> In-Reply-To: <20240504103305.GD3167983@kernel.org> References: <20240430-feature_ptp_netnext-v12-0-2c5f24b6a914@bootlin.com> <20240430-feature_ptp_netnext-v12-12-2c5f24b6a914@bootlin.com> <20240504103305.GD3167983@kernel.org> Organization: bootlin X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-GND-Sasl: kory.maincent@bootlin.com On Sat, 4 May 2024 11:33:05 +0100 Simon Horman wrote: > Hi Kory, >=20 > A few lines beyond this hunk, within the "if (hwtstamp)" block, > is the following: >=20 > cfg->qualifier =3D dev->hwtstamp->qualifier; >=20 > Now that dev->hwtstamp is managed using RCU, I don't think it is correct > to dereference it directly like this. Rather, the hwtstamp local variable, > which has rcu_dereference'd this pointer should be used: >=20 > cfg->qualifier =3D hwtstamp->qualifier; >=20 > Flagged by Sparse. Yes indeed, thanks for the report. >=20 > ... >=20 > > diff --git a/net/ethtool/tsinfo.c b/net/ethtool/tsinfo.c =20 >=20 > ... >=20 > > +static int ethnl_tsinfo_dump_one_dev(struct sk_buff *skb, struct > > net_device *dev, > > + struct netlink_callback *cb) > > +{ > > + struct ethnl_tsinfo_dump_ctx *ctx =3D (void *)cb->ctx; > > + struct ptp_clock *ptp; > > + int ret; > > + > > + netdev_for_each_ptp_clock_start(dev, ctx->pos_phcindex, ptp, > > + ctx->pos_phcindex) { > > + ret =3D ethnl_tsinfo_dump_one_ptp(skb, dev, cb, ptp); > > + if (ret < 0 && ret !=3D -EOPNOTSUPP) > > + break; > > + ctx->pos_phcqualifier =3D > > HWTSTAMP_PROVIDER_QUALIFIER_PRECISE; > > + } > > + > > + return ret; =20 >=20 > Perhaps it is not possible, but if the loop iterates zero times then > ret will be used uninitialised here. Yes thanks! Regards, --=20 K=C3=B6ry Maincent, Bootlin Embedded Linux and kernel engineering https://bootlin.com