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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aXDrQGzTGrAeA-fB@smile.fi.intel.com>
Date: Wed, 21 Jan 2026 17:05:36 +0200
From: Andy Shevchenko <andriy.shevchenko@...el.com>
To: Francesco Lavra <flavra@...libre.com>
Cc: Lorenzo Bianconi <lorenzo@...nel.org>,
	Jonathan Cameron <jic23@...nel.org>,
	David Lechner <dlechner@...libre.com>,
	Nuno Sá <nuno.sa@...log.com>,
	Andy Shevchenko <andy@...nel.org>, linux-iio@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] iio: imu: st_lsm6dsx: Fix check for invalid samples from
 FIFO

On Wed, Jan 21, 2026 at 03:05:54PM +0100, Francesco Lavra wrote:
> On Wed, 2026-01-21 at 14:47 +0200, Andy Shevchenko wrote:
> > On Wed, Jan 21, 2026 at 12:27:57PM +0100, Francesco Lavra wrote:

...

> > >  st_lsm6dsx_push_tagged_data(struct st_lsm6dsx_hw *hw, u8 tag,
> > >                             u8 *data, s64 ts)
> > >  {
> > > -       s16 val = le16_to_cpu(*(__le16 *)data);
> > >         struct st_lsm6dsx_sensor *sensor;
> > >         struct iio_dev *iio_dev;
> > >  
> > >         /* invalid sample during bootstrap phase */
> > > -       if (val >= ST_LSM6DSX_INVALID_SAMPLE)
> > > +       if ((tag == ST_LSM6DSX_GYRO_TAG || tag == ST_LSM6DSX_ACC_TAG)
> > > &&
> > > +           (s16)le16_to_cpup((__le16 *)data) >=
> > > ST_LSM6DSX_INVALID_SAMPLE)
> > 
> > Since data is u8 *, it might appear on unaligned addresses and the proper
> > conversion here is to use get_unaligned_le16() without any of those ugly
> > castings.
> 
> data here corresponds to iio_buff in st_lsm6dsx_read_tagged_fifo(), which
> is declared as __aligned(8), so it cannot appear on unaligned addresses.

You know that, compiler might not. If you sure, you should change u8 *data
to be __le16 *data in the function parameter. Until it's u8 *, the
get_unaligned_le16() is the error free thing to achieve that.

> > >                 return -EINVAL;

-- 
With Best Regards,
Andy Shevchenko



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ