]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[librm] Fail gracefully if asked to ioremap() a zero length
authorMichael Brown <mcb30@ipxe.org>
Tue, 21 Mar 2017 12:17:18 +0000 (14:17 +0200)
committerMichael Brown <mcb30@ipxe.org>
Tue, 21 Mar 2017 12:17:18 +0000 (14:17 +0200)
Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/arch/x86/transitions/librm_mgmt.c

index 8776f2854230e5e18f0d386b997c15fe5b7c21da..8144e76712b8533eabdc13f2d4d131873b3df5ef 100644 (file)
@@ -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 ) );