]> err.no Git - linux-2.6/commitdiff
[PATCH] drivers/pnp/pnpbios/rsparser.c: fix an array overflow
authorAdrian Bunk <bunk@stusta.de>
Sun, 1 May 2005 15:59:29 +0000 (08:59 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Sun, 1 May 2005 15:59:29 +0000 (08:59 -0700)
This patch fixes an array overflow found by the Coverity checker.

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/pnp/pnpbios/rsparser.c

index 618ac15a9e90b2f1b98e76eb15225f989cf138bc..79bce7b7574085e34d4fcddb4cd8a9189c459e06 100644 (file)
@@ -72,7 +72,9 @@ static void
 pnpbios_parse_allocated_dmaresource(struct pnp_resource_table * res, int dma)
 {
        int i = 0;
-       while (!(res->dma_resource[i].flags & IORESOURCE_UNSET) && i < PNP_MAX_DMA) i++;
+       while (i < PNP_MAX_DMA &&
+                       !(res->dma_resource[i].flags & IORESOURCE_UNSET))
+               i++;
        if (i < PNP_MAX_DMA) {
                res->dma_resource[i].flags = IORESOURCE_DMA;  // Also clears _UNSET flag
                if (dma == -1) {