Re: [PATCH] iio: adc: ti-ads1018: fix type overflow for data rate

From: Andy Shevchenko

Date: Thu Mar 05 2026 - 02:07:29 EST


On Thu, Mar 05, 2026 at 10:15:50AM +0800, Chunyang Chen wrote:
> The variable 'drate' is currently defined as u8. However, the data rate
> values in ads1018 can reach up to 3300 Hz (e.g., in ads1018_data_rate[]),
> which exceeds the maximum value of 255 that a u8 can hold.
>
> Change the type of 'drate' to u16 to prevent integer overflow and
> ensure the data rate is handled correctly.

Needs Fixes tag.

--
With Best Regards,
Andy Shevchenko