Skip to contentSkip to conversation

drivers/pnp/pnpacpi/rsparser.c: fix an array overflow

PATCH New Adrian Bunk 1 participant 1 message Apr 9, 2005

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers/pnp/pnpacpi/rsparser.c: fix an array overflow

This patch fixes an array overflow found by the Coverity checker.

---

This patch was already sent on:
- 27 Mar 2005

drivers/pnp/pnpacpi/rsparser.c renamed from drivers/pnp/pnpacpi/rsparser.c.old +2 -2
@@ -94,8 +94,8 @@
 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

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click