diff options
author | Michael Brown | 2017-03-21 13:17:18 +0100 |
---|---|---|
committer | Michael Brown | 2017-03-21 13:17:18 +0100 |
commit | d25e7daf47efbefa83bbf9c07e044cdf747c7fda (patch) | |
tree | 8419876c5cbc461efe0328506a2c9fb62ced3b32 /src/arch | |
parent | [crypto] Free correct pointer on the error path (diff) | |
download | ipxe-d25e7daf47efbefa83bbf9c07e044cdf747c7fda.tar.gz ipxe-d25e7daf47efbefa83bbf9c07e044cdf747c7fda.tar.xz ipxe-d25e7daf47efbefa83bbf9c07e044cdf747c7fda.zip |
[librm] Fail gracefully if asked to ioremap() a zero length
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/arch')
-rw-r--r-- | src/arch/x86/transitions/librm_mgmt.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/arch/x86/transitions/librm_mgmt.c b/src/arch/x86/transitions/librm_mgmt.c index 8776f285..8144e767 100644 --- a/src/arch/x86/transitions/librm_mgmt.c +++ b/src/arch/x86/transitions/librm_mgmt.c @@ -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 ); /* Sanity check */ - assert ( len != 0 ); + if ( ! len ) + return NULL; /* Round down start address to a page boundary */ start = ( bus_addr & ~( IO_PAGE_SIZE - 1 ) ); |