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

Isaku Yamahata yamahata at valinux.co.jp
Tue Jul 27 11:11:39 CEST 2010

On Mon, Jul 26, 2010 at 09:45:42PM -0400, Kevin O'Connor wrote:
> 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.

Yes, contiguous allocation is necessary for bridge filtering.
Anyway I'll give pmm_malloc() a try and see what can be done.

More information about the SeaBIOS mailing list