Explorar el Código

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

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown hace 7 años
padre
commit
d25e7daf47
Se han modificado 1 ficheros con 2 adiciones y 1 borrados
  1. 2
    1
      src/arch/x86/transitions/librm_mgmt.c

+ 2
- 1
src/arch/x86/transitions/librm_mgmt.c Ver fichero

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

Loading…
Cancelar
Guardar