projects
/
seabios.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
vgabios: Check that the PCI BDF passed in is valid before using.
[seabios.git]
/
vgasrc
/
clext.c
diff --git
a/vgasrc/clext.c
b/vgasrc/clext.c
index eaef60af50a109296cba3353605b7cf56dc042a1..5468db35ef77d6e9e4099ed0669772527cb6abc0 100644
(file)
--- a/
vgasrc/clext.c
+++ b/
vgasrc/clext.c
@@
-736,10
+736,10
@@
clext_init(void)
return -1;
dprintf(1, "cirrus init 2\n");
return -1;
dprintf(1, "cirrus init 2\n");
- SET_VGA(VBE_enabled, 1);
u32 lfb_addr = 0;
u32 lfb_addr = 0;
- if (CONFIG_VGA_PCI)
- lfb_addr = (pci_config_readl(GET_GLOBAL(VgaBDF), PCI_BASE_ADDRESS_0)
+ int bdf = GET_GLOBAL(VgaBDF);
+ if (CONFIG_VGA_PCI && bdf >= 0)
+ lfb_addr = (pci_config_readl(bdf, PCI_BASE_ADDRESS_0)
& PCI_BASE_ADDRESS_MEM_MASK);
SET_VGA(VBE_framebuffer, lfb_addr);
u16 totalmem = cirrus_get_memsize();
& PCI_BASE_ADDRESS_MEM_MASK);
SET_VGA(VBE_framebuffer, lfb_addr);
u16 totalmem = cirrus_get_memsize();