aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pnp/pnpbios
diff options
context:
space:
mode:
authorAdrian Bunk <bunk@stusta.de>2005-05-01 11:59:29 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-05-01 11:59:29 -0400
commit6e3e98d1dcf944b999757b769d910f2b506ca5b9 (patch)
treea070040633da1748df638673819479ceaf7efce2 /drivers/pnp/pnpbios
parent408b664a7d394a5e4315fbd14aca49b042cb2b08 (diff)
[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 <bunk@stusta.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/pnp/pnpbios')
-rw-r--r--drivers/pnp/pnpbios/rsparser.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/pnp/pnpbios/rsparser.c b/drivers/pnp/pnpbios/rsparser.c
index 618ac15a9e90..79bce7b75740 100644
--- a/drivers/pnp/pnpbios/rsparser.c
+++ b/drivers/pnp/pnpbios/rsparser.c
@@ -72,7 +72,9 @@ static void
72pnpbios_parse_allocated_dmaresource(struct pnp_resource_table * res, int dma) 72pnpbios_parse_allocated_dmaresource(struct pnp_resource_table * res, int dma)
73{ 73{
74 int i = 0; 74 int i = 0;
75 while (!(res->dma_resource[i].flags & IORESOURCE_UNSET) && i < PNP_MAX_DMA) i++; 75 while (i < PNP_MAX_DMA &&
76 !(res->dma_resource[i].flags & IORESOURCE_UNSET))
77 i++;
76 if (i < PNP_MAX_DMA) { 78 if (i < PNP_MAX_DMA) {
77 res->dma_resource[i].flags = IORESOURCE_DMA; // Also clears _UNSET flag 79 res->dma_resource[i].flags = IORESOURCE_DMA; // Also clears _UNSET flag
78 if (dma == -1) { 80 if (dma == -1) {