Skip to content

Commit

Permalink
mfd: WM8350 off by one bug
Browse files Browse the repository at this point in the history
If irq == WM8350_NUM_IRQ that would put us past the end of the array.

Signed-off-by: Dan Carpenter <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
Signed-off-by: Samuel Ortiz <[email protected]>
  • Loading branch information
error27 authored and Samuel Ortiz committed Jan 18, 2010
1 parent 9dffe2a commit 6f2af72
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/mfd/wm8350-irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ int wm8350_register_irq(struct wm8350 *wm8350, int irq,
irq_handler_t handler, unsigned long flags,
const char *name, void *data)
{
if (irq < 0 || irq > WM8350_NUM_IRQ || !handler)
if (irq < 0 || irq >= WM8350_NUM_IRQ || !handler)
return -EINVAL;

if (wm8350->irq[irq].handler)
Expand All @@ -453,7 +453,7 @@ EXPORT_SYMBOL_GPL(wm8350_register_irq);

int wm8350_free_irq(struct wm8350 *wm8350, int irq)
{
if (irq < 0 || irq > WM8350_NUM_IRQ)
if (irq < 0 || irq >= WM8350_NUM_IRQ)
return -EINVAL;

wm8350_mask_irq(wm8350, irq);
Expand Down

0 comments on commit 6f2af72

Please sign in to comment.