Linux block layer
 help / color / mirror / Atom feed
From: "Denis Efremov (Oracle)" <efremov@linux.com>
To: Nathan Chancellor <nathan@kernel.org>
Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
	llvm@lists.linux.dev, stable@vger.kernel.org,
	Jens Axboe <axboe@kernel.dk>
Subject: Re: [PATCH] floppy: Avoid unsequenced accesses to jiffies in show_floppy()
Date: Mon, 16 Nov 2026 20:16:30 +0400	[thread overview]
Message-ID: <a89b5be6-998a-4f3e-8768-0a64a9b33d61@linux.com> (raw)
In-Reply-To: <20261114-floppy-wunsequenced-v1-1-a54dba6754c4@kernel.org>

Hi,

Applied, thanks!

c1a8feb71ba8 floppy: Avoid unsequenced accesses to jiffies in show_floppy()

https://github.com/evdenis/linux-floppy branch for-7.5/floppy

Denis

On 15/11/2026 08:41, Nathan Chancellor wrote:
> After a recent improvement in clang to warn on unsequenced accesses to
> volatile variables [1], an instance appears in show_floppy(), which can
> break the build with CONFIG_WERROR=y / W=e:
> 
>   drivers/block/floppy.c:1839:30: error: unsequenced accesses to volatile qualified 'jiffies' [-Werror,-Wunsequenced]
>    1839 |                 jiffies, interruptjiffies, jiffies - interruptjiffies,
>         |                 ~~~~~~~                    ^
> 
> 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
> Closes: https://github.com/ClangBuiltLinux/linux/issues/2198
> Link: https://github.com/llvm/llvm-project/commit/955715460eaf9188c241c74750637fc82dfcc423 [1]
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---
>  drivers/block/floppy.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
> index c677d783811f..f6339d779be9 100644
> --- a/drivers/block/floppy.c
> +++ b/drivers/block/floppy.c
> @@ -1830,13 +1830,14 @@ static void reset_fdc(void)
>  
>  static void show_floppy(int fdc)
>  {
> +	unsigned long j = jiffies;
>  	int i;
>  
>  	pr_info("\n");
>  	pr_info("floppy driver state\n");
>  	pr_info("-------------------\n");
>  	pr_info("now=%lu last interrupt=%lu diff=%lu last called handler=%ps\n",
> -		jiffies, interruptjiffies, jiffies - interruptjiffies,
> +		j, interruptjiffies, j - interruptjiffies,
>  		lasthandler);
>  
>  	pr_info("timeout_message=%s\n", timeout_message);
> 
> ---
> base-commit: ab43ec385580b8f8abf72d70fa3acbf4e4f098a5
> change-id: 20261114-floppy-wunsequenced-8b739d08b849
> 
> Best regards,
> --  
> Cheers,
> Nathan
> 


      reply	other threads:[~2026-11-16 16:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-15  4:41 [PATCH] floppy: Avoid unsequenced accesses to jiffies in show_floppy() Nathan Chancellor
2026-11-16 16:16 ` Denis Efremov (Oracle) [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a89b5be6-998a-4f3e-8768-0a64a9b33d61@linux.com \
    --to=efremov@linux.com \
    --cc=axboe@kernel.dk \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=nathan@kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox