[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20110921064415.GC4999@elgon.mountain>
Date: Wed, 21 Sep 2011 09:44:15 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: Mark Brown <broonie@...nsource.wolfsonmicro.com>
Cc: Ian Lartey <ian@...nsource.wolfsonmicro.com>,
Dimitris Papastamos <dp@...nsource.wolfsonmicro.com>,
Samuel Ortiz <sameo@...ux.intel.com>,
linux-kernel@...r.kernel.org
Subject: re: 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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists