lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f040255ef1b3be87050b8255c947b4b375e75a02.camel@gmail.com>
Date:   Mon, 06 Nov 2023 11:07:16 +0100
From:   Nuno Sá <noname.nuno@...il.com>
To:     Alexander Lobakin <aleksander.lobakin@...el.com>,
        Nuno Sa <nuno.sa@...log.com>
Cc:     Dan Carpenter <dan.carpenter@...aro.org>,
        oe-kbuild@...ts.linux.dev, lkp@...el.com,
        oe-kbuild-all@...ts.linux.dev,
        Przemek Kitszel <przemyslaw.kitszel@...el.com>,
        linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [alobakin:pfcp 5/20] drivers/iio/imu/adis16475.c:363
 adis16475_set_freq() warn: set_bit() takes a bit number

Hi Olek,

On Mon, 2023-11-06 at 10:31 +0100, Alexander Lobakin wrote:
> From: Dan Carpenter <dan.carpenter@...aro.org>
> Date: Mon, 6 Nov 2023 11:50:03 +0300
> 
> Hi,
> 
> > tree:   https://github.com/alobakin/linux pfcp
> > head:   89565e300e3d4033b8bb568774804fdc09d4f3cc
> > commit: 945a0d6e86d97bf60f2fae88ee557ed3eae18b94 [5/20] bitops: let the compiler
> > optimize {__,}assign_bit()
> > config: i386-randconfig-141-20231105
> > (https://download.01.org/0day-ci/archive/20231106/202311060647.i9XyO4ej-lkp@intel
> > .com/config)
> > compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
> > reproduce:
> > (https://download.01.org/0day-ci/archive/20231106/202311060647.i9XyO4ej-lkp@intel
> > .com/reproduce)
> > 
> > If you fix the issue in a separate patch/commit (i.e. not just a new version of
> > the same patch/commit), kindly add following tags
> > > Reported-by: kernel test robot <lkp@...el.com>
> > > Reported-by: Dan Carpenter <dan.carpenter@...aro.org>
> > > Closes: https://lore.kernel.org/r/202311060647.i9XyO4ej-lkp@intel.com/
> > 
> > smatch warnings:
> > drivers/iio/imu/adis16475.c:363 adis16475_set_freq() warn: set_bit() takes a bit
> > number
> > drivers/iio/imu/adis16475.c:363 adis16475_set_freq() warn: clear_bit() takes a
> > bit number
> > drivers/iio/imu/adis16475.c:416 adis16475_set_filter() warn: set_bit() takes a
> > bit number
> > drivers/iio/imu/adis16475.c:416 adis16475_set_filter() warn: clear_bit() takes a
> > bit number
> > 
> > vim +363 drivers/iio/imu/adis16475.c
> > 
> > fff7352bf7a3ce Nuno Sá 2020-04-13  357  
> > 9da1b86865ab43 Nuno Sá 2021-09-20  358          adis_dev_unlock(&st->adis);
> > fff7352bf7a3ce Nuno Sá 2020-04-13  359          /*
> > fff7352bf7a3ce Nuno Sá 2020-04-13  360           * If decimation is used, then
> > gyro and accel data will have meaningful
> > fff7352bf7a3ce Nuno Sá 2020-04-13  361           * bits on the LSB registers.
> > This info is used on the trigger handler.
> > fff7352bf7a3ce Nuno Sá 2020-04-13  362           */
> > fff7352bf7a3ce Nuno Sá 2020-04-13
> > @363          assign_bit(ADIS16475_LSB_DEC_MASK, &st->lsb_flag, dec);
> > 
> > assign_bit() takes a bit number like 0.  But this is passing BIT(0) so
> > it's like BIT(BIT(0)).  Which is fine until you get to 5.
> 
> Is this intended? There are 2 places where you pass
> %ADIS16475_LSB_DEC_MASK and %ADIS16475_LSB_FIR_MASK, which is `BIT(0)`
> and `BIT(1)` respectively, to assign_bit(), which takes 0, 1 etc.
> 

Sorry, I'm missing the point in here... This should be a simple mask as 
GENMASK(1, 0) setting/clearing the bits when appropriate. Obviously, 
ADIS16475_LSB_DEC_MASK and ADIS16475_LSB_FIR_MASK are not properly defined
:sweat_smile:

- Nuno Sá
> 
> > 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ