Procházet zdrojové kódy

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

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown před 7 roky
rodič
revize
d25e7daf47
1 změnil soubory, kde provedl 2 přidání a 1 odebrání
  1. 2
    1
      src/arch/x86/transitions/librm_mgmt.c

+ 2
- 1
src/arch/x86/transitions/librm_mgmt.c Zobrazit soubor

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 ) );

Načítá se…
Zrušit
Uložit