[patch 14/29] PCI: Adjust PCI rom code to handle more broken ROMs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Jon Smirl <[email protected]>

There are ROMs reporting that their size exceeds their PCI ROM
resource window. This patch returns the minimum of the resource window
size or the size in the ROM.  An example of this breakage is the XGI
Volari Z7.

Signed-off-by: Jon Smirl <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
 drivers/pci/rom.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletion(-)

--- gregkh-2.6.orig/drivers/pci/rom.c	2005-07-29 11:29:50.000000000 -0700
+++ gregkh-2.6/drivers/pci/rom.c	2005-07-29 11:36:22.000000000 -0700
@@ -125,7 +125,9 @@
 		image += readw(pds + 16) * 512;
 	} while (!last_image);
 
-	*size = image - rom;
+	/* never return a size larger than the PCI resource window */
+	/* there are known ROMs that get the size wrong */
+	*size = min((size_t)(image - rom), *size);
 
 	return rom;
 }

--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]
  Powered by Linux