public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jari Ruusu <jariruusu@users.sourceforge.net>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org,
	Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>,
	Sasha Levin <sashal@kernel.org>
Subject: Re: Linux 4.19.154
Date: Sat, 31 Oct 2020 15:14:41 +0200	[thread overview]
Message-ID: <5F9D6341.71F2A54E@users.sourceforge.net> (raw)
In-Reply-To: 160405368043128@kroah.com

Greg Kroah-Hartman wrote:
> --- a/block/blk-core.c
> +++ b/block/blk-core.c
> @@ -2127,11 +2127,10 @@ static void handle_bad_sector(struct bio *bio, sector_t maxsector)
>  {
>         char b[BDEVNAME_SIZE];
> 
> -       printk(KERN_INFO "attempt to access beyond end of device\n");
> -       printk(KERN_INFO "%s: rw=%d, want=%Lu, limit=%Lu\n",
> -                       bio_devname(bio, b), bio->bi_opf,
> -                       (unsigned long long)bio_end_sector(bio),
> -                       (long long)maxsector);
> +       pr_info_ratelimited("attempt to access beyond end of device\n"
> +                           "%s: rw=%d, want=%llu, limit=%llu\n",
> +                           bio_devname(bio, b), bio->bi_opf,
> +                           bio_end_sector(bio), maxsector);
>  }
> 
>  #ifdef CONFIG_FAIL_MAKE_REQUEST

Above change "block: ratelimit handle_bad_sector() message"
upstream commit f4ac712e4fe009635344b9af5d890fe25fcc8c0d
in 4.19.154 kernel is not completely OK.

Removing casts from arguments 4 and 5 produces these compile warnings:



In file included from ./include/linux/kernel.h:14:0,
                 from block/blk-core.c:14:
block/blk-core.c: In function 'handle_bad_sector':
./include/linux/kern_levels.h:5:18: warning: format '%llu' expects argument of type 'long long unsigned int', but argument 4 has type 'sector_t {aka long unsigned int}' [-Wformat=]
 #define KERN_SOH "\001"  /* ASCII Start Of Header */
                  ^
./include/linux/printk.h:424:10: note: in definition of macro 'printk_ratelimited'
   printk(fmt, ##__VA_ARGS__);    \
          ^~~
./include/linux/kern_levels.h:14:19: note: in expansion of macro 'KERN_SOH'
 #define KERN_INFO KERN_SOH "6" /* informational */
                   ^~~~~~~~
./include/linux/printk.h:444:21: note: in expansion of macro 'KERN_INFO'
  printk_ratelimited(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
                     ^~~~~~~~~
block/blk-core.c:2130:2: note: in expansion of macro 'pr_info_ratelimited'
  pr_info_ratelimited("attempt to access beyond end of device\n"
  ^~~~~~~~~~~~~~~~~~~
./include/linux/kern_levels.h:5:18: warning: format '%llu' expects argument of type 'long long unsigned int', but argument 5 has type 'sector_t {aka long unsigned int}' [-Wformat=]
 #define KERN_SOH "\001"  /* ASCII Start Of Header */
                  ^
./include/linux/printk.h:424:10: note: in definition of macro 'printk_ratelimited'
   printk(fmt, ##__VA_ARGS__);    \
          ^~~
./include/linux/kern_levels.h:14:19: note: in expansion of macro 'KERN_SOH'
 #define KERN_INFO KERN_SOH "6" /* informational */
                   ^~~~~~~~
./include/linux/printk.h:444:21: note: in expansion of macro 'KERN_INFO'
  printk_ratelimited(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
                     ^~~~~~~~~
block/blk-core.c:2130:2: note: in expansion of macro 'pr_info_ratelimited'
  pr_info_ratelimited("attempt to access beyond end of device\n"
  ^~~~~~~~~~~~~~~~~~~



For 64 bit systems it is only compile time cosmetic warning. For 32 bit
system + CONFIG_LBDAF=n it introduces bugs: output formats are "%llu" and
passed parameters are 32 bits. That is not OK.

Upstream kernels have hardcoded 64 bit sector_t. In older stable trees
sector_t can be either 64 or 32 bit. In other words, backport of above patch
needs to keep those original casts.

-- 
Jari Ruusu  4096R/8132F189 12D6 4C3A DCDA 0AA4 27BD  ACDF F073 3C80 8132 F189

  reply	other threads:[~2020-10-31 13:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-30 10:28 Linux 4.19.154 Greg Kroah-Hartman
2020-10-30 10:28 ` Greg Kroah-Hartman
2020-10-31 13:14   ` Jari Ruusu [this message]
2020-10-31 14:02     ` Tetsuo Handa
2020-11-01 10:44       ` Greg Kroah-Hartman

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=5F9D6341.71F2A54E@users.sourceforge.net \
    --to=jariruusu@users.sourceforge.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=penguin-kernel@I-love.SAKURA.ne.jp \
    --cc=sashal@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