浏览代码

[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 年前
父节点
当前提交
d25e7daf47
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2
    1
      src/arch/x86/transitions/librm_mgmt.c

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

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

正在加载...
取消
保存