Article View: linux.kernel.netdev
Article #16692Re: [PATCH net] net: microchip: encx24j600: Avoid unsequenced accesses to jiffies in encx24j600_tx()
From: Andrew Lunn
Date: Sun, 15 Nov 2026 15:52
Date: Sun, 15 Nov 2026 15:52
29 lines
9621 bytes
9621 bytes
On Sat, Nov 14, 2026 at 09:38:26PM -0700, Nathan Chancellor wrote:
> After a recent improvement in clang to warn on unsequenced accesses to
> volatile variables [1], an instance appears in encx24j600_tx(), which
> can break the build with CONFIG_WERROR=y / W=e:
>
> drivers/net/ethernet/microchip/encx24j600.c:898:14: error: unsequenced accesses to volatile qualified 'jiffies' [-Werror,-Wunsequenced]
> 898 | jiffies, jiffies - dev_trans_start(dev));
> | ~~~~~~~ ^
>
> Per C11 5.1.2.3.2, accessing a volatile object is a side effect. Per C11
> 6.5.2, unsequenced side effects on the same scalar object are undefined
> behavior. Per C11 6.5.2.2.10/12, the evaluation of arguments in a
> function call is indeterminately sequenced, meaning any side effects in
> the arguments are unsequenced.
>
> Add a local variable to hold the value of jiffies before the function
> call so that there are no unsequenced side effects, clearing up the
> warning.
>
> Cc: stable@vger.kernel.org
> Fixes: 04fbfce7a222 ("net: Microchip encx24j600 driver")
> Closes: https://github.com/ClangBuiltLinux/linux/issues/2196
> Link: https://github.com/llvm/llvm-project/commit/955715460eaf9188c241c74750637fc82dfcc423 [1]
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
Technical Details
Message-ID:
<58014e4c-fd79-44d7-af47-35da26616570@lunn.ch>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-363750-linux-kernel-netdev=dewy.ruReferences:
<20261114-encx24j600-wunsequenced-v1-1-c978fc36cacd@kernel.org>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-363750-linux-kernel-netdev=dewy.ru From: andrew@lunn.ch (Andrew Lunn) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net] net: microchip: encx24j600: Avoid unsequenced accesses to jiffies in encx24j600_tx() Date: Sun, 15 Nov 2026 16:52:55 +0100 Organization: Usenet Network Message-ID: <58014e4c-fd79-44d7-af47-35da26616570@lunn.ch> References: <20261114-encx24j600-wunsequenced-v1-1-c978fc36cacd@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: usenet.network; logging-data="1844047"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:8GpfiTU9BipO04maS2bU/d6N+z0= sha256:KMU4pJmGzOwhXaqmjh1nsTP84WQy5ZSPnKyUoCFIivg= sha1:JKZ0B1MqQGqME17sl+Em82r4f0E= sha256:xq3CeBMY4sA3QsQLNDSFRpfpg5vdPQgD667ldI5qtvI= Content-Disposition: inline List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 4B0291149FF; Sun, 15 Nov 2026 18:53:32 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.151 X-Spam-Status: No, score=-3.151 tagged_above=-9999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (1024-bit key) header.d=lunn.ch X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 9rqYJUxqdpOJ; Sun, 15 Nov 2026 18:53:27 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-363750-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=lunn.ch X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74]) by mail.dewy.ru (Postfix) with ESMTPS id B92281144D3; Sun, 15 Nov 2026 18:53:18 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sto.lore.kernel.org (Postfix) with ESMTP id A5D3D606B59; Sun, 15 Nov 2026 15:53:04 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1794757981; b=Wr2NQ4CzEFNhZ9dsSF+VUsmhBx4YhPqLjTmVDy9V5uuf0uTubgGAhJTE+qQ8em/NKsIX gqbAQ4p7MZ5oK7x4oMcB7xTTINiOOCTY2YbcNRoJnDuicZV90KeMwPK+BFrd5q5MWThtE VPXwiSUQub8/s7noMH6fpyBSppleMjZm0Xw0qigxwIjbH3phbhOcINZAwkJBDptKi6Y0P gFf2V3SMIwNAmaL6UwK6tqUcQV1I+B+YrgKY8niDbwk8dxZf2t0RUIkPVwdM/w2zCHGoW tNmo0Z2J5KuvBoN8Rb6IICA/nmZEMXeSBxjoE9uoHaFlJrLyzMlVdiLhxs9pjlK9/qg== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794757981; h=X-Original-To:Received:DMARC-Filter:DKIM-Signature:Received:Date: From:To:Cc:Subject:Message-ID:References:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=3w2k8dv60M9yhIxrZGVgOz8RjAq82d6eRw88JC7KQX8=; b=foxz1hz2x5BChRJG4jwrgexb4jK6x+qGEbiEwYAoxQYDWM5CpBaKVOvraI6nOY8Jew5E bV2Ywl4HKNa7TwvP0H7dotDMDE9S55D3fHHMHgPDIiehZfGKbg7zZL/Ej9XmfH08HHJSl w7FGBpQrcluj1iE6uaR1+qsz9Lkcn3Ak9xfW1FFUbmpK7EZ4vLsLQkaxqill10OPYSQ+B twbIqWm+ISbaPIG6VQUIA1Q+JG+NafZO7et4Dz5j3hRBQCuCJqlzr4Nd2stsyut1lx0O8 heMjGZSWSQtZmoKgIDxSWO3krDUfBTL4Fx1GZSUm1Hjtye75ASrwV/GSu8ca8Ix2bog== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=lunn.ch header.i=@lunn.ch header.a=rsa-sha256 header.s=20171124 header.b=5PuG6+tJ; dmarc=pass header.from=lunn.ch; spf=pass smtp.mailfrom=lunn.ch; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CE956606A337; Sun, 15 Nov 2026 15:53:01 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.a=rsa-sha256 header.s=20171124 header.b=5PuG6+tJ X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=156.67.10.101 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794757981; b=MP/7O4FomxD7Aw9uNgnEYJ1cT+t96IoW+cVjYPitt8f5mz7lRvhZ4Xs8yNSbZhWyL/07 d2PszTzrTKf2QNqKHTsi64hDIVFCa/HmN9qWAyTptiJe8rZjsCZV4urD2TBp0R7vobb3Y inWDQU1RCDTk8cs/NGzaEMgTYHTBBgys0pcOjyNdrLnQsyV4nLn3oDDzTQDQfomTokXZN xH1A5aP0A2j6oUfw1mE/ME6HiWtrmvuwJP8MHdqTzasb5XeazL9v3Uh9H4JTf5Fz2Bht6 PQbCs+784PVgV0XYzqd8u5dPYISX94wizBEmun5m1PtL+F1m6WdvzLiwws5IR5BMuPw== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794757981; h=DMARC-Filter:DKIM-Signature:Received:Date:From:To:Cc:Subject: Message-ID:References:MIME-Version:Content-Type:Content-Disposition: In-Reply-To; bh=3w2k8dv60M9yhIxrZGVgOz8RjAq82d6eRw88JC7KQX8=; b=1ynuJPiki3JTSRFxKCdWQSWzZDEafgvVsw7zn85u9/eaPJWjXWmdyVXQMV3oX9PpHquF 9P0FTIAAvKYafXel4fxZXPL58bZ7Z31JGL7gPGQqH5odfjThnwvkcnJhq/Sy6ycC3Dsxj PTOKWRT0Ax3by5o/v6bPpxCh1cTCCWaQYdrm7aJWmIBSaUI4/2ENr9ScxpDO2wPqAVYTq eQocRzIa+chgLP42rkncPFbcn2RLA2WSC96LxvKdqeG2zoKlqvLJT3AR5NwIMjUGthAVY dTMY7C7gfWr/u6+SyjHy15wiqGnpzPK/3lX1ZPSGoQtQ5enN0tQeKUnkiZu6uak21/g== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=lunn.ch; spf=pass smtp.mailfrom=lunn.ch; dkim=pass header.d=lunn.ch header.i=@lunn.ch header.a=rsa-sha256 header.s=20171124 header.b=5PuG6+tJ; arc=none smtp.remote-ip=156.67.10.101 X-Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AA2D5606A334; Sun, 15 Nov 2026 15:53:00 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org AA2D5606A334 X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lunn.ch X-DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=3w2k8dv60M9yhIxrZGVgOz8RjAq82d6eRw88JC7KQX8=; b=5PuG6+tJNvkZcOd+koxl9dO8Up 2s8H+g6pF4Nty9+e3X93gr8+RsU+m25LMKR0z9qxMzeLJFfTUfgk/fCkKP8ClkHHQmkNPtK7DfBnq WVr8jYk7pkpGY+qGnIUBKGDL84cKBCUxOAa5zHeeYxYwLHeAIzF+AOBkVhEHRg8WKHxU=; X-Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from <andrew@lunn.ch>) id 1xScXH-00GdYo-RW; Sun, 15 Nov 2026 16:52:55 +0100 X-Cc: Andrew Lunn <andrew+netdev@lunn.ch>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@kernel.org>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, stable@vger.kernel.org X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list X-In-Reply-To: <20261114-encx24j600-wunsequenced-v1-1-c978fc36cacd@kernel.org>