Thread View: linux.kernel.netdev
3 messages
3 total messages
Started by Nathan Chancellor
Sun, 15 Nov 2026 04:38
[PATCH net] net: microchip: encx24j600: Avoid unsequenced accesses to jiffies in encx24j600_tx()
Author: Nathan Chancellor
Date: Sun, 15 Nov 2026 04:38
Date: Sun, 15 Nov 2026 04:38
53 lines
10547 bytes
10547 bytes
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>
---
drivers/net/ethernet/microchip/encx24j600.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/microchip/encx24j600.c b/drivers/net/ethernet/microchip/encx24j600.c
index b011bf5c2305..ebc067cb2c9d 100644
--- a/drivers/net/ethernet/microchip/encx24j600.c
+++ b/drivers/net/ethernet/microchip/encx24j600.c
@@ -893,9 +893,10 @@ static netdev_tx_t encx24j600_tx(struct sk_buff *skb, struct net_device *dev)
static void encx24j600_tx_timeout(struct net_device *dev, unsigned int txqueue)
{
struct encx24j600_priv *priv = netdev_priv(dev);
+ unsigned long j = jiffies;
netif_err(priv, tx_err, dev, "TX timeout at %ld, latency %ld\n",
- jiffies, jiffies - dev_trans_start(dev));
+ j, j - dev_trans_start(dev));
dev->stats.tx_errors++;
netif_wake_queue(dev);
---
base-commit: aa40afa831ebfe45e40a23721711059f2ac584d4
change-id: 20261114-encx24j600-wunsequenced-d1c43cc36c2b
Best regards,
--
Cheers,
Nathan
Re: [PATCH net] net: microchip: encx24j600: Avoid unsequenced accesses to jiffies in encx24j600_tx()
Author: 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
Re: [PATCH net] net: microchip: encx24j600: Avoid unsequenced accesses to jiffies in encx24j600_tx()
Author: patchwork-bot+netdevbpf
Date: Wed, 18 Nov 2026 02:50
Date: Wed, 18 Nov 2026 02:50
25 lines
8808 bytes
8808 bytes
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Sat, 14 Nov 2026 21:38:26 -0700 you 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));
> | ~~~~~~~ ^
>
> [...]
Here is the summary with links:
- [net] net: microchip: encx24j600: Avoid unsequenced accesses to jiffies in encx24j600_tx()
https://git.kernel.org/netdev/net/c/5ec918f8d66a
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads