Skip to contentSkip to conversation

leds: leds-tca6507: off by one in choose_times()

DISCUSSION Dan Carpenter 1 participant 1 message Dec 16, 2011

lore
Share & tools
lore
#0 lore raw

Hi Neil,

Smatch complains about 7a9244d89523 "leds: add driver for TCA6507 LED controller"

drivers/leds/leds-tca6507.c +185 choose_times(16)
error: buffer overflow 'time_codes' 16 <= 16

184 for (c1 = 1; c1 <= TIMECODES; c1++) {

   185                  int t = time_codes[c1];
                                ^^^^^^^^^^^^^

We're reading 1 past the end of the array here.

186 if (t*2 < tmin)
187 continue;

regards,
dan carpenter