summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkettenis <kettenis@openbsd.org>2016-02-04 07:16:18 +0000
committerkettenis <kettenis@openbsd.org>2016-02-04 07:16:18 +0000
commit643547056573aa3239e748b408dd929a3eac25d7 (patch)
tree467fdc6aef3cbec589f07ddee7682dc5f9487855
parentsync (diff)
downloadwireguard-openbsd-643547056573aa3239e748b408dd929a3eac25d7.tar.xz
wireguard-openbsd-643547056573aa3239e748b408dd929a3eac25d7.zip
If the ROM size is 0, we won't be able to read the video BIOS from it.
Bail out early to prevent a panic from calling bus_space_map(9) with size 0.
-rw-r--r--sys/dev/pci/drm/radeon/radeon_bios.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/dev/pci/drm/radeon/radeon_bios.c b/sys/dev/pci/drm/radeon/radeon_bios.c
index ff98adee436..7d7b8ee123f 100644
--- a/sys/dev/pci/drm/radeon/radeon_bios.c
+++ b/sys/dev/pci/drm/radeon/radeon_bios.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: radeon_bios.c,v 1.6 2015/04/12 12:14:30 jsg Exp $ */
+/* $OpenBSD: radeon_bios.c,v 1.7 2016/02/04 07:16:18 kettenis Exp $ */
/*
* Copyright 2008 Advanced Micro Devices, Inc.
* Copyright 2008 Red Hat Inc.
@@ -144,6 +144,8 @@ static bool radeon_read_bios(struct radeon_device *rdev)
pci_conf_write(rdev->pc, rdev->pa_tag, PCI_ROM_REG, address);
size = PCI_ROM_SIZE(mask);
+ if (size == 0)
+ return false;
rc = bus_space_map(rdev->memt, PCI_ROM_ADDR(address), size,
BUS_SPACE_MAP_LINEAR, &romh);
if (rc != 0) {