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]
Date:   Mon, 17 Jan 2022 11:56:07 +0100
From:   Lorenzo Bianconi <lorenzo@...nel.org>
To:     Paul Cercueil <paul@...pouillou.net>
Cc:     Jonathan Cameron <jic23@...nel.org>,
        Lars-Peter Clausen <lars@...afoo.de>,
        linux-iio@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
        linux-kernel@...r.kernel.org,
        Lorenzo Bianconi <lorenzo.bianconi83@...il.com>
Subject: Re: [PATCH 1/2] iio: imu: st_lsm6dsx: Limit requested watermark
 value to hwfifo size

> Instead of returning an error if the watermark value is too high, which
> the core will silently ignore anyway, limit the value to the hardware
> FIFO size; a lower-than-requested value is still better than using the
> default, which is usually 1.
> 

Acked-by: Lorenzo Bianconi <lorenzo@...nel.org>

> Cc: Lorenzo Bianconi <lorenzo.bianconi83@...il.com>
> Signed-off-by: Paul Cercueil <paul@...pouillou.net>
> ---
>  drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
> index 727b4b6ac696..5fd46bf1a11b 100644
> --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
> +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
> @@ -54,6 +54,7 @@
>  #include <linux/iio/sysfs.h>
>  #include <linux/interrupt.h>
>  #include <linux/irq.h>
> +#include <linux/minmax.h>
>  #include <linux/pm.h>
>  #include <linux/property.h>
>  #include <linux/regmap.h>
> @@ -1607,8 +1608,7 @@ int st_lsm6dsx_set_watermark(struct iio_dev *iio_dev, unsigned int val)
>  	struct st_lsm6dsx_hw *hw = sensor->hw;
>  	int err;
>  
> -	if (val < 1 || val > hw->settings->fifo_ops.max_size)
> -		return -EINVAL;
> +	val = clamp_val(val, 1, hw->settings->fifo_ops.max_size);
>  
>  	mutex_lock(&hw->conf_lock);
>  
> -- 
> 2.34.1
> 

Download attachment "signature.asc" of type "application/pgp-signature" (229 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ