[PATCH intel-gpu-tools] intel_bios_dumper: handle rom_size == 0
Forest Bond
forest at alittletooquiet.net
Tue Mar 22 07:31:43 PDT 2011
Some versions of libpciaccess on Linux set rom_size to 0 for VGA
devices. While this behavior may change, intel_bios_dumper should
handle this situation to be compatible with current versions of the
library.
This fixes segmentation faults on affected systems.
Signed-off-by: Forest Bond <forest.bond at rapidrollout.com>
---
tools/intel_bios_dumper.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/tools/intel_bios_dumper.c b/tools/intel_bios_dumper.c
index 53293eb..0fa1833 100644
--- a/tools/intel_bios_dumper.c
+++ b/tools/intel_bios_dumper.c
@@ -77,6 +77,11 @@ int main(int argc, char **argv)
if (dev->vendor_id != 0x8086)
errx(1, "Graphics card is non-intel");
+ /* Some versions of libpciaccess correct this automatically, but some
+ * don't. */
+ if (dev->rom_size == 0)
+ dev->rom_size = 64 * 1024;
+
bios = malloc(dev->rom_size);
if (bios == NULL)
errx(1, "Couldn't allocate memory for BIOS data\n");
--
1.7.0.4
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.x.org/archives/xorg-devel/attachments/20110322/6a9bf430/attachment.pgp>
More information about the xorg-devel
mailing list