Skip to contentSkip to conversation

avr32: off by one in at32_init_pio()

PATCH In review Dan Carpenter 2 participants 2 messages Jul 13, 2016 – Jul 14, 2016 Kernel janitors

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 avr32: off by one in at32_init_pio()

The pio_dev[] array has MAX_NR_PIO_DEVICES elements so the > should be

Quoted 1 line

=.

Fixes 5f97f7f9400d ('[PATCH] avr32 architecture')
arch/avr32/mach-at32ap/pio.c +1 -1
index 83c2a00..13d3fc4 100644
@@ -435,7 +435,7 @@ void __init at32_init_pio(struct platform_device *pdev)
 	struct resource *regs;
 	struct pio_device *pio;
 
-	if (pdev->id > MAX_NR_PIO_DEVICES) {
+	if (pdev->id >= MAX_NR_PIO_DEVICES) {
 		dev_err(&pdev->dev, "only %d PIO devices supported\n",
 			MAX_NR_PIO_DEVICES);
 		return;
Acked-by on v1 1/1
#1 lore raw
Quoted 2 lines · Dan Carpenter

The pio_dev[] array has MAX_NR_PIO_DEVICES elements so the > should be

Quoted 1 line

=.

So it should, no off by one error in the kernel anyway, since at32ap700x only probes 5 PIO instances.

Quoted 2 lines
Fixes 5f97f7f9400d ('[PATCH] avr32 architecture')

I will add this to my linux-next branch for the next merge window.

Quoted 14 lines
arch/avr32/mach-at32ap/pio.c +1 -1
index 83c2a00..13d3fc4 100644
@@ -435,7 +435,7 @@ void __init at32_init_pio(struct platform_device *pdev)
 	struct resource *regs;
 	struct pio_device *pio;
 
-	if (pdev->id > MAX_NR_PIO_DEVICES) {
+	if (pdev->id >= MAX_NR_PIO_DEVICES) {
 		dev_err(&pdev->dev, "only %d PIO devices supported\n",
 			MAX_NR_PIO_DEVICES);
 		return;
Signature · 2 lines
mvh
Hans-Christian Noren Egtvedt