[PATCH 0/2] iio: chemical: sps30: fix buffer size calculations

Antoniu Miclaus posted 2 patches 1 month, 2 weeks ago
drivers/iio/chemical/sps30_i2c.c    | 2 +-
drivers/iio/chemical/sps30_serial.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
[PATCH 0/2] iio: chemical: sps30: fix buffer size calculations
Posted by Antoniu Miclaus 1 month, 2 weeks ago
Fix incorrect buffer size calculations in sps30_i2c_read_meas() and
sps30_serial_read_meas(). Both functions used sizeof(num) which
evaluates to sizeof(size_t) (8 bytes on 64-bit) instead of
sizeof(*meas) (4 bytes for __be32), leading to oversized buffer
requests.

Antoniu Miclaus (2):
  iio: chemical: sps30_i2c: fix buffer size in sps30_i2c_read_meas()
  iio: chemical: sps30_serial: fix buffer size in
    sps30_serial_read_meas()

 drivers/iio/chemical/sps30_i2c.c    | 2 +-
 drivers/iio/chemical/sps30_serial.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

-- 
2.43.0
Re: [PATCH 0/2] iio: chemical: sps30: fix buffer size calculations
Posted by Jonathan Cameron 1 month, 1 week ago
On Thu, 12 Feb 2026 14:46:06 +0200
Antoniu Miclaus <antoniu.miclaus@analog.com> wrote:

> Fix incorrect buffer size calculations in sps30_i2c_read_meas() and
> sps30_serial_read_meas(). Both functions used sizeof(num) which
> evaluates to sizeof(size_t) (8 bytes on 64-bit) instead of
> sizeof(*meas) (4 bytes for __be32), leading to oversized buffer
> requests.
> 
> Antoniu Miclaus (2):
>   iio: chemical: sps30_i2c: fix buffer size in sps30_i2c_read_meas()
>   iio: chemical: sps30_serial: fix buffer size in
>     sps30_serial_read_meas()
> 
>  drivers/iio/chemical/sps30_i2c.c    | 2 +-
>  drivers/iio/chemical/sps30_serial.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
Applied to the fixes-togreg branch of iio.git and marked for stable.

Thanks,

Jonathan