Re: [PATCH] hwmon: (ntc_thermistor) return error instead of clipping on OOB

From: Guenter Roeck
Date: Thu Mar 06 2025 - 15:55:23 EST


On Thu, Mar 06, 2025 at 01:35:53PM +0000, Maud Spierings | GOcontroll wrote:
> >
> >Most of the above should be after "---" since it is irrelevant for the commit log.
>
> I believe my cover letter seperated it correctly after my signed-off-by
> tag.
>
Yes, you are correct. I missed the second (or, rather, first) "---"
above. Sorry for the noise.

> >> +     /*
> >> +      * theoretically data->comp[0].ohm can be greater than INT_MAX as it is an
> >> +      * unsigned integer, but it doesn't make any sense for it to be so as the
> >> +      * maximum return value of this function is INT_MAX, so it will never be
> >> +      * able to properly calculate that temperature.
> >> +      */
> >>        if (n > INT_MAX)
> >>                n = INT_MAX;
> >
> >I am not a friend of theoretic code or comments like this. Please drop.
> >The original code was intended to catch out-of-bounds values which would
> >otherwise have been reported as error, not to catch unrealistic resistor
> >values in the compensation tables.
>
> So, drop the check and comment? Or just drop the comment? I was thinking
> to fully remove that check in an earlier comment in my cover letter.

Drop both.

Thanks,
Guenter