From: Michael Brown Date: Tue, 21 Mar 2017 12:17:18 +0000 (+0200) Subject: [librm] Fail gracefully if asked to ioremap() a zero length X-Git-Tag: v1.20.1~280 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d25e7daf47efbefa83bbf9c07e044cdf747c7fda;p=thirdparty%2Fipxe.git [librm] Fail gracefully if asked to ioremap() a zero length Signed-off-by: Michael Brown --- diff --git a/src/arch/x86/transitions/librm_mgmt.c b/src/arch/x86/transitions/librm_mgmt.c index 8776f2854..8144e7671 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 ) );