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: <CAHp75VdEBjxYS_4g2j=ofjFWuGyTK5Me=9mMNcy5ienUUs67Ag@mail.gmail.com>
Date:   Mon, 10 Aug 2020 11:02:45 +0300
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     trix@...hat.com
Cc:     Jonathan Cameron <jic23@...nel.org>,
        Hartmut Knaack <knaack.h@....de>,
        Lars-Peter Clausen <lars@...afoo.de>,
        Peter Meerwald <pmeerw@...erw.net>,
        Jean-Baptiste Maneyrol <jmaneyrol@...ensense.com>,
        Michał Mirosław <mirq-linux@...e.qmqm.pl>,
        Lee Jones <lee.jones@...aro.org>,
        linux-iio <linux-iio@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] iio: imu: inv_mpu6050: check for temp_fifo_enable

On Sun, Aug 9, 2020 at 7:00 PM <trix@...hat.com> wrote:
>
> From: Tom Rix <trix@...hat.com>
>
> clang static analysis reports this problem
>
> inv_mpu_ring.c:181:18: warning: Division by zero
>         nb = fifo_count / bytes_per_datum;
>              ~~~~~~~~~~~^~~~~~~~~~~~~~~~~
>
> This is a false positive.
> Dividing by 0 is protected by this check
>
>         if (!(st->chip_config.accl_fifo_enable |
>                 st->chip_config.gyro_fifo_enable |
>                 st->chip_config.magn_fifo_enable))
>                 goto end_session;
>         bytes_per_datum = 0;
>
> But there is another fifo, temp_fifo
>
>         if (st->chip_config.temp_fifo_enable)
>                 bytes_per_datum += INV_MPU6050_BYTES_PER_TEMP_SENSOR;
>
> Which would be skipped if it was the only enabled fifo.
> So add to the check.
>

> Fixes: 2e4c0a5e2576 ("iio: imu: inv_mpu6050: add fifo temperature data support")
>
> Signed-off-by: Tom Rix <trix@...hat.com>

There shouldn't be a blank line in between.

Other than that,
Reviewed-by: Andy Shevchenko <andy.shevchenko@...il.com>



> ---
>  drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c
> index b533fa2dad0a..5240a400dcb4 100644
> --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c
> +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c
> @@ -141,6 +141,7 @@ irqreturn_t inv_mpu6050_read_fifo(int irq, void *p)
>
>         if (!(st->chip_config.accl_fifo_enable |
>                 st->chip_config.gyro_fifo_enable |
> +               st->chip_config.temp_fifo_enable |
>                 st->chip_config.magn_fifo_enable))
>                 goto end_session;
>         bytes_per_datum = 0;
> --
> 2.18.1
>


--
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ