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] [day] [month] [year] [list]
Date:   Fri, 13 May 2022 10:49:04 +0200
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     kernel test robot <lkp@...el.com>
Cc:     LI Qingwu <Qing-wu.Li@...ca-geosystems.com.cn>,
        Jonathan Cameron <jic23@...nel.org>,
        Lars-Peter Clausen <lars@...afoo.de>,
        Rob Herring <robh+dt@...nel.org>,
        Tomas Melin <tomas.melin@...sala.com>,
        devicetree <devicetree@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        kbuild-all@...ts.01.org, linux-iio <linux-iio@...r.kernel.org>
Subject: Re: [PATCH V5 3/5] iio: accel: sca3300: modified to support multi chips

On Fri, May 13, 2022 at 2:30 AM kernel test robot <lkp@...el.com> wrote:
>
> Hi LI,
>
> Thank you for the patch! Perhaps something to improve:
>
> [auto build test WARNING on jic23-iio/togreg]
> [also build test WARNING on v5.18-rc6]
> [If your patch is applied to the wrong git tree, kindly drop us a note.
> And when submitting patch, we suggest to use '--base' as documented in
> https://git-scm.com/docs/git-format-patch]
>
> url:    https://github.com/intel-lab-lkp/linux/commits/LI-Qingwu/iio-accel-sca3300-add-compatible-for-scl3300/20220513-000857
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
> config: arm-randconfig-c002-20220512 (https://download.01.org/0day-ci/archive/20220513/202205130756.Q7e8x6jf-lkp@intel.com/config)
> compiler: arm-linux-gnueabi-gcc (GCC) 11.3.0
> 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://github.com/intel-lab-lkp/linux/commit/15579266e58d7cdf4ff8e7ad7a4fa30a0bd3a589
>         git remote add linux-review https://github.com/intel-lab-lkp/linux
>         git fetch --no-tags linux-review LI-Qingwu/iio-accel-sca3300-add-compatible-for-scl3300/20220513-000857
>         git checkout 15579266e58d7cdf4ff8e7ad7a4fa30a0bd3a589
>         # save the config file
>         mkdir build_dir && cp config build_dir/.config
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash drivers/iio/accel/
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@...el.com>
>
> All warnings (new ones prefixed by >>):
>
>    drivers/iio/accel/sca3300.c: In function 'sca3300_get_op_mode':
> >> drivers/iio/accel/sca3300.c:288:58: warning: suggest parentheses around comparison in operand of '&' [-Wparentheses]
>      288 |                 if (sca_data->chip->avail_modes_table[i] == reg_val&0x03)
>          |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~

Good catch, LKP!

>    277  static int sca3300_get_op_mode(struct sca3300_data *sca_data, int *index)
>    278  {
>    279          int reg_val;
>    280          int ret;
>    281          int i;
>    282
>    283          ret = sca3300_read_reg(sca_data, SCA3300_REG_MODE, &reg_val);
>    284          if (ret)
>    285                  return ret;
>    286

Instead, I suggest to split the below, which is invariant to the loop,
into a line here:

regval &= GENMASK(1, 0);

>    287          for (i = 0; i < sca_data->chip->num_avail_modes; i++) {
>  > 288                  if (sca_data->chip->avail_modes_table[i] == reg_val&0x03)
>    289                          break;
>    290          }
>    291
>    292          if (i >= sca_data->chip->num_avail_modes)
>    293                  return -EINVAL;
>    294
>    295          *index = i;
>    296          return 0;
>    297  }

-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ