Hi Denis, On Thu, Sep 19, 2024 at 05:29:14PM +0300, Denis Arefev wrote: > No upstream commit exists for this commit. Sorry, what does this mean? > > If the adp5588_read function returns 0, then there will be an > overflow of the kpad->keycode[key_val - 1] buffer. > > If the adp5588_read function returns a negative value, then the > logic is broken - the wrong value is used as an index of > the kpad->keycode array. > > Found by Linux Verification Center (linuxtesting.org) with SVACE. > > Fixes: 69a4af606ed4 ("Input: adp5588-keys - support GPI events for ADP5588 devices") > Cc: stable@xxxxxxxxxxxxxxx > Signed-off-by: Denis Arefev <arefev@xxxxxxxxx> > --- > drivers/input/keyboard/adp5588-keys.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/input/keyboard/adp5588-keys.c b/drivers/input/keyboard/adp5588-keys.c > index 90a59b973d00..19be8054eb5f 100644 > --- a/drivers/input/keyboard/adp5588-keys.c > +++ b/drivers/input/keyboard/adp5588-keys.c > @@ -272,6 +272,8 @@ static void adp5588_report_events(struct adp5588_kpad *kpad, int ev_cnt) > int key = adp5588_read(kpad->client, Key_EVENTA + i); > int key_val = key & KEY_EV_MASK; > > + if (key_val <= 0) > + continue; We should be checking the original value (key) and not masked value. Masked value will never be negative. int key, key_vali, key_press; key = adp5588_read(kpad->client, Key_EVENTA + i); if (key < 0) continue; key_val = key & key & KEY_EV_MASK; key_press = key & KEY_EV_PRESSED; if (key_val >= GPI_PIN_BASE && key_val <= GPI_PIN_END) { ... } else if (key_val > 0) { ... } Thanks. -- Dmitry