* Bug in omap3evm.c?
@ 2010-05-10 23:08 Rick Ball
2010-05-12 14:04 ` Ranjith Lohithakshan
0 siblings, 1 reply; 2+ messages in thread
From: Rick Ball @ 2010-05-10 23:08 UTC (permalink / raw)
To: linux-omap@vger.kernel.org
I think I've found a small problem in the board-omap3evm.c file under arch/arm/mach-omap2 (support for the TI/Mistral OMAP35x EVM board).
What I noticed is that the declaration for the array gpio_leds is initialized with one element (at line 380):
static struct gpio_led gpio_leds[] = {
{
.name = "omap3evm::ledb",
/* normally not visible (board underside) */
.default_trigger = "default-on",
.gpio = -EINVAL, /* gets replaced */
.active_low = true,
},
};
But then down at line 430 element 2 is set:
/* TWL4030_GPIO_MAX + 1 == ledB (out, active low LED) */
gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1;
How did the array end up with 3 elements so that 2 would be a valid index? It looks to me like it wouldn't flag an error, but would corrupt memory. I'd submit a patch, but I'm not sure what this code was attempting to do...
Rick Ball
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Bug in omap3evm.c?
2010-05-10 23:08 Bug in omap3evm.c? Rick Ball
@ 2010-05-12 14:04 ` Ranjith Lohithakshan
0 siblings, 0 replies; 2+ messages in thread
From: Ranjith Lohithakshan @ 2010-05-12 14:04 UTC (permalink / raw)
To: Rick Ball; +Cc: linux-omap@vger.kernel.org
On Tue, 11-May-10 4:38 AM +0530, Rick Ball wrote:
> I think I've found a small problem in the board-omap3evm.c file under arch/arm/mach-omap2 (support for the TI/Mistral OMAP35x EVM board).
>
> What I noticed is that the declaration for the array gpio_leds is initialized with one element (at line 380):
>
> static struct gpio_led gpio_leds[] = {
> {
> .name = "omap3evm::ledb",
> /* normally not visible (board underside) */
> .default_trigger = "default-on",
> .gpio = -EINVAL, /* gets replaced */
> .active_low = true,
> },
> };
>
> But then down at line 430 element 2 is set:
>
> /* TWL4030_GPIO_MAX + 1 == ledB (out, active low LED) */
> gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1;
>
> How did the array end up with 3 elements so that 2 would be a valid index? It looks to me like it wouldn't flag an error, but would corrupt memory. I'd submit a patch, but I'm not sure what this code was attempting to do...
This appears to be like a bug. Possibly there would have been some
entries earlier which got removed, but the indexing done in the code
never got updated.
- Ranjith
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-05-12 14:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-10 23:08 Bug in omap3evm.c? Rick Ball
2010-05-12 14:04 ` Ranjith Lohithakshan
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.