Re: [PATCH] iio: adc: nxp-sar-adc: fix division by zero in write_raw
From: Jonathan Cameron
Date: Fri May 15 2026 - 07:28:27 EST
On Mon, 20 Apr 2026 15:34:18 +0100
Jonathan Cameron <jic23@xxxxxxxxxx> wrote:
> On Wed, 1 Apr 2026 18:29:24 +0300
> Antoniu Miclaus <antoniu.miclaus@xxxxxxxxxx> wrote:
>
> > Add a validation check for the sampling frequency value before using it
> > as a divisor. A user writing zero or a negative value to the
> > sampling_frequency sysfs attribute triggers a division by zero in the
> > kernel.
> >
> > Also prevent unsigned integer underflow when the computed cycle count is
> > smaller than NXP_SAR_ADC_CONV_TIME, which would wrap the u32 inpsamp to
> > a huge value.
> >
> > Fixes: fdee77dea4b6 ("iio: adc: Add the NXP SAR ADC support for the s32g2/3 platforms")
This tag is wrong. I only just noticed when running final tests
before sending a pull request. I obviously missed running them
earlier but please be very careful to get these right as I have
to rebase whenever one gets past me.
Correct hash is 4434072a893e
Jonathan