[SeaBIOS] [PATCH 2/2] seabios: pciinit: fix overflow when bar allocation.

Kevin O'Connor kevin at koconnor.net
Tue Jul 27 03:45:42 CEST 2010


On Mon, Jul 26, 2010 at 02:02:46PM +0900, Isaku Yamahata wrote:
> When allocating bar, overflow can occur.
> So add overflow check and don't allocate bar if overflowed.
> Overflow check is ugly, but necessary.
> Another suggested way is to change related variables u64 from u32
> thus overflow can't occur because the related value are all u32 addressable.
> Anyway even with u64, it is necessary to the resulted value > max_u32.

I wonder if we could create malloc zones for this and then use
pmm_alloc.  The pmm_alloc function already handles overflow and
alignments.

One difficulty, though, is that pmm_alloc doesn't guarentee linear
allocations, and it looks like pci_bios_init_device_bridge assumes
this.

-Kevin



More information about the SeaBIOS mailing list