Browse Source

[librm] Fail gracefully if asked to ioremap() a zero length

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 7 years ago
parent
commit
d25e7daf47
1 changed files with 2 additions and 1 deletions
  1. 2
    1
      src/arch/x86/transitions/librm_mgmt.c

+ 2
- 1
src/arch/x86/transitions/librm_mgmt.c View File

197
 	DBGC ( &io_pages, "IO mapping %08lx+%zx\n", bus_addr, len );
197
 	DBGC ( &io_pages, "IO mapping %08lx+%zx\n", bus_addr, len );
198
 
198
 
199
 	/* Sanity check */
199
 	/* Sanity check */
200
-	assert ( len != 0 );
200
+	if ( ! len )
201
+		return NULL;
201
 
202
 
202
 	/* Round down start address to a page boundary */
203
 	/* Round down start address to a page boundary */
203
 	start = ( bus_addr & ~( IO_PAGE_SIZE - 1 ) );
204
 	start = ( bus_addr & ~( IO_PAGE_SIZE - 1 ) );

Loading…
Cancel
Save