From 0dec63bab860cc60cc444faa0ac459f1b53545ff Mon Sep 17 00:00:00 2001 From: Adrian Bunk Date: Sun, 1 May 2005 08:59:30 -0700 Subject: [PATCH] drivers/pnp/pnpacpi/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/pnpacpi/rsparser.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/pnp/pnpacpi') diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c index c0ddb1eb8c4..dd61e09029b 100644 --- a/drivers/pnp/pnpacpi/rsparser.c +++ b/drivers/pnp/pnpacpi/rsparser.c @@ -94,8 +94,8 @@ static void pnpacpi_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) + 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 -- cgit v1.2.3-70-g09d2