Re: [song-md:md-next 6/6] drivers/md/md-bitmap.c:2541:12: warning: result of comparison of constant 4294967296 with expression of type 'unsigned long' is always false

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Oct 24, 2022 at 7:31 AM Jinpu Wang <jinpu.wang@xxxxxxxxx> wrote:
>
> On Fri, Oct 21, 2022 at 4:21 AM kernel test robot <lkp@xxxxxxxxx> wrote:
> >
> > tree:   git://git.kernel.org/pub/scm/linux/kernel/git/song/md.git md-next
> > head:   c748adfcbe0bd0c760c68d78434a1dfc0344b6b6
> > commit: c748adfcbe0bd0c760c68d78434a1dfc0344b6b6 [6/6] md/bitmap: Fix bitmap chunk size overflow issues
> > config: i386-randconfig-a004
> > compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
> > reproduce (this is a W=1 build):
> >         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> >         chmod +x ~/bin/make.cross
> >         # https://git.kernel.org/pub/scm/linux/kernel/git/song/md.git/commit/?id=c748adfcbe0bd0c760c68d78434a1dfc0344b6b6
> >         git remote add song-md git://git.kernel.org/pub/scm/linux/kernel/git/song/md.git
> >         git fetch --no-tags song-md md-next
> >         git checkout c748adfcbe0bd0c760c68d78434a1dfc0344b6b6
> >         # save the config file
> >         mkdir build_dir && cp config build_dir/.config
> >         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/md/
> >
> > If you fix the issue, kindly add following tag where applicable
> > | Reported-by: kernel test robot <lkp@xxxxxxxxx>
> >
> > All warnings (new ones prefixed by >>):
> >
> > >> drivers/md/md-bitmap.c:2541:12: warning: result of comparison of constant 4294967296 with expression of type 'unsigned long' is always false [-Wtautological-constant-out-of-range-compare]
> >            if (csize >= (1ULL << (BITS_PER_BYTE *
> >                ~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~
> >    1 warning generated.
> >
> Thx for catch it.
> This can be fixed by:
> diff --git a/drivers/md/md-bitmap.c b/drivers/md/md-bitmap.c
> index 44f29cb1fde1..be9f3a768c9f 100644
> --- a/drivers/md/md-bitmap.c
> +++ b/drivers/md/md-bitmap.c
> @@ -2538,7 +2538,7 @@ chunksize_store(struct mddev *mddev, const char
> *buf, size_t len)
>         if (csize < 512 ||
>             !is_power_of_2(csize))
>                 return -EINVAL;
> -       if (csize >= (1ULL << (BITS_PER_BYTE *
> +       if (BITS_PER_LONG == 64 && csize >= (1ULL << (BITS_PER_BYTE *
>
> Song, do you want a seperate fix or will you fold it into the patch itself?

Please fold this in the patch and resend. I will replace the commit and force
push to md-next.

Thanks,
Song

> >
> > vim +2541 drivers/md/md-bitmap.c
> >
> >   2526
> >   2527  static ssize_t
> >   2528  chunksize_store(struct mddev *mddev, const char *buf, size_t len)
> >   2529  {
> >   2530          /* Can only be changed when no bitmap is active */
> >   2531          int rv;
> >   2532          unsigned long csize;
> >   2533          if (mddev->bitmap)
> >   2534                  return -EBUSY;
> >   2535          rv = kstrtoul(buf, 10, &csize);
> >   2536          if (rv)
> >   2537                  return rv;
> >   2538          if (csize < 512 ||
> >   2539              !is_power_of_2(csize))
> >   2540                  return -EINVAL;
> > > 2541          if (csize >= (1ULL << (BITS_PER_BYTE *
> >   2542                  sizeof(((bitmap_super_t *)0)->chunksize))))
> >   2543                  return -EOVERFLOW;
> >   2544          mddev->bitmap_info.chunksize = csize;
> >   2545          return len;
> >   2546  }
> >   2547
> >
> > --
> > 0-DAY CI Kernel Test Service
> > https://01.org/lkp



[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux