[librm] Fail gracefully if asked to ioremap() a zero length
Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
parent
36cffe054d
commit
d25e7daf47
|
@ -197,7 +197,8 @@ static void * ioremap_pages ( unsigned long bus_addr, size_t len ) {
|
||||||
DBGC ( &io_pages, "IO mapping %08lx+%zx\n", bus_addr, len );
|
DBGC ( &io_pages, "IO mapping %08lx+%zx\n", bus_addr, len );
|
||||||
|
|
||||||
/* Sanity check */
|
/* Sanity check */
|
||||||
assert ( len != 0 );
|
if ( ! len )
|
||||||
|
return NULL;
|
||||||
|
|
||||||
/* Round down start address to a page boundary */
|
/* Round down start address to a page boundary */
|
||||||
start = ( bus_addr & ~( IO_PAGE_SIZE - 1 ) );
|
start = ( bus_addr & ~( IO_PAGE_SIZE - 1 ) );
|
||||||
|
|
Reference in New Issue