xorg-x11-server/xserver-1.3.0-mmap-failure-check.patch
Adam Jackson 115cc5d8ad * Mon Apr 09 2007 Adam Jackson <ajax@redhat.com> 1.2.99.905-2
- xserver-1.3.0-pci-bus-count.patch: Allocate the PCI bus array dynamically,
  so as not to run off the end of it.
- xserver-1.3.0-mmap-failure-check.patch: Check for failure when mmap'ing
  bus memory. (#234073)
- xserver-1.3.0-rom-search.patch: Look for the sysfs ROM file in the (flat)
  /sys/bus/pci/devices tree, instead of the (bus-topological) /sys/devices,
  so we don't fail to find ROMs merely because they're behind a bridge.
- xserver-1.3.0-no-pseudocolor-composite.patch: Refuse to initialize
  Composite when Render is missing or when the root window is using
  a pseudocolor visual. (#217388)
- xserver-1.3.0-xnest-exposures.patch: Fix Motif app redraw in Xnest. (#229350)
2007-04-09 23:09:52 +00:00

42 lines
1.3 KiB
Diff

--- ./hw/xfree86/os-support/bus/linuxPci.c.orig 2007-03-14 09:37:44.000000000 -0600
+++ ./hw/xfree86/os-support/bus/linuxPci.c 2007-03-14 09:41:01.000000000 -0600
@@ -634,28 +634,28 @@
ADDRESS Base, unsigned long Size)
{
int domain = xf86GetPciDomain(Tag);
- int fd;
+ int fd = -1;
pointer addr;
/*
* We use /proc/bus/pci on non-legacy addresses or if the Linux sysfs
* legacy_mem interface is unavailable.
*/
- if (Base > 1024*1024)
- return linuxMapPci(ScreenNum, Flags, Tag, Base, Size,
+ if (Base >= 1024*1024)
+ addr = linuxMapPci(ScreenNum, Flags, Tag, Base, Size,
PCIIOC_MMAP_IS_MEM);
-
- if ((fd = linuxOpenLegacy(Tag, "legacy_mem")) < 0)
- return linuxMapPci(ScreenNum, Flags, Tag, Base, Size,
+ else if ((fd = linuxOpenLegacy(Tag, "legacy_mem")) < 0)
+ addr = linuxMapPci(ScreenNum, Flags, Tag, Base, Size,
PCIIOC_MMAP_IS_MEM);
+ else
+ addr = mmap(NULL, Size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, Base);
- addr = mmap(NULL, Size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, Base);
- if (addr == MAP_FAILED) {
- close (fd);
+ if (fd >= 0)
+ close(fd);
+ if (addr == NULL || addr == MAP_FAILED) {
perror("mmap failure");
FatalError("xf86MapDomainMem(): mmap() failure\n");
}
- close(fd);
return addr;
}