瀏覽代碼

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

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 8 年之前
父節點
當前提交
d25e7daf47
共有 1 個文件被更改,包括 2 次插入1 次删除
  1. 2
    1
      src/arch/x86/transitions/librm_mgmt.c

+ 2
- 1
src/arch/x86/transitions/librm_mgmt.c 查看文件

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…
取消
儲存