Re: [PATCH] iio: humidity: hts221: fix division by zero in calibration data parsing
From: Andy Shevchenko
Date: Mon Aug 31 2026 - 03:08:44 EST
On Mon, Aug 31, 2026 at 01:00:21AM +0100, Jonathan Cameron wrote:
> On Wed, 26 Aug 2026 17:09:49 +0300
> Andy Shevchenko <andriy.shevchenko@xxxxxxxxx> wrote:
> > On Tue, Aug 25, 2026 at 05:21:10PM +0800, Yang Zi wrote:
...
> > Do you have HW to test? Any fault injection perhaps?
> > The problem with div-by-0 is that it's implementation defined, meaning
> > that it's how compiler decides. Now, the question is, what will compiler
> > do in the current code (no patch applied)?
> >
> Whilst all this is true, the code shouldn't be relying on any particular
> behavior. So do we need to know?
That's my point. If code relies on that, it should be spelled clearly in
the commit message. Then we will deliberately break that (nasty and wrong)
behaviour.
> Reality is the hardware is almost certainly never returning values where this
> is true.
--
With Best Regards,
Andy Shevchenko