lkml.org 
[lkml]   [2011]   [Sep]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subjectre: mfd: Simulate active high IRQs with wm831x
Hi Mark,

Smatch complains about d71820b8a8fbe9 "mfd: Simulate active high IRQs
with wm831x"

drivers/mfd/wm831x-irq.c +522 wm831x_irq_thread(67)
error: buffer overflow 'wm831x->gpio_level' 16 <= 56

518 /* Simulate an edge triggered IRQ by polling the input
519 * status. This is sucky but improves interoperability.
520 */
521 if (primary == WM831X_GP_INT &&
522 wm831x->gpio_level[i - WM831X_IRQ_GPIO_1]) {
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
523 ret = wm831x_reg_read(wm831x, WM831X_GPIO_LEVEL);
524 while (ret & 1 << (i - WM831X_IRQ_GPIO_1)) {
525 handle_nested_irq(wm831x->irq_base + i);
526 ret = wm831x_reg_read(wm831x,
527 WM831X_GPIO_LEVEL);
528 }
529 }

We're inside a for loop over ARRAY_SIZE(wm831x_irqs) which has 58
elements (so "i" is 0-57) and we subtract WM831X_IRQ_GPIO_1 (1) which
gives us a max of 56. The ->gpio_level[] array only has 16 elements
so we're reading beyond the end of the array.

In wm831x_irq_set_type() it only sets the first 11 elements of the
->gpio_level[] array. Perhaps something similar is needed here. I
don't know the code well enough to say.

regards,
dan carpenter


\
 
 \ /
  Last update: 2011-09-21 08:47    [W:0.036 / U:6.524 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site