Re: [PATCH 2/3] iio: light: veml6075: add bounds check to veml6075_it_ms index
From: Greg Kroah-Hartman
Date: Fri May 15 2026 - 11:06:02 EST
On Fri, May 15, 2026 at 03:33:07PM +0100, Jonathan Cameron wrote:
> On Fri, 15 May 2026 08:17:18 +1300
> "Javier Carrasco" <javier.carrasco.cruz@xxxxxxxxx> wrote:
>
> > On Fri May 15, 2026 at 5:23 AM +13, Greg Kroah-Hartman wrote:
> > > From: Sam Daly <sam@xxxxxxxxxx>
> > >
> > > veml6075_it_ms has 5 elements but VEML6075_CONF_IT can yield
> > > values 0-7. If it returns a value >= 5, this causes an
> > > out-of-bounds array access. Add a bounds check and return
> > > -EINVAL if the index is out of range.
>
> I'd prefer it if this sort of change called out that we don't expect
> to ever see those values except when we have bus corruption or
> a broken device. Good to protect against but that info might help
> folk decide whether to backport or not.
Thanks. This came from a run of "look at all of these bugfixes and find
where we need to also apply the same pattern" of my bot.
> I'll add a note whilst applying. Applied to the fixes-togreg
> branch of iio.git. I also rewrapped the description as 60 chars
> is rather short.
Thanks!
greg k-h