From: Adrian Bunk Date: Sun, 1 May 2005 15:59:30 +0000 (-0700) Subject: [PATCH] drivers/pnp/pnpacpi/rsparser.c: fix an array overflow X-Git-Tag: firefly_0821_release~42725^2~78 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=0dec63bab860cc60cc444faa0ac459f1b53545ff;p=firefly-linux-kernel-4.4.55.git [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 --- diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c index c0ddb1eb8c4d..dd61e09029b1 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