From 6e3e98d1dcf944b999757b769d910f2b506ca5b9 Mon Sep 17 00:00:00 2001 From: Adrian Bunk Date: Sun, 1 May 2005 08:59:29 -0700 Subject: [PATCH] drivers/pnp/pnpbios/rsparser.c: fix an array overflow This patch fixes an array overflow found by the Coverity checker. Signed-off-by: Adrian Bunk Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/pnp/pnpbios/rsparser.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/pnp/pnpbios/rsparser.c b/drivers/pnp/pnpbios/rsparser.c index 618ac15..79bce7b 100644 --- a/drivers/pnp/pnpbios/rsparser.c +++ b/drivers/pnp/pnpbios/rsparser.c @@ -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) { -- cgit v1.1