瀏覽代碼

[arbel] Assert that mapping length is non-zero

An (impossible) mapping length of zero produces a negative bit shift,
which is technically undefined.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 7 年之前
父節點
當前提交
0ced99e97c
共有 1 個檔案被更改,包括 1 行新增0 行删除
  1. 1
    0
      src/drivers/infiniband/arbel.c

+ 1
- 0
src/drivers/infiniband/arbel.c 查看文件

@@ -1972,6 +1972,7 @@ static int arbel_map_vpm ( struct arbel *arbel,
1972 1972
 	assert ( ( va & ( ARBEL_PAGE_SIZE - 1 ) ) == 0 );
1973 1973
 	assert ( ( pa & ( ARBEL_PAGE_SIZE - 1 ) ) == 0 );
1974 1974
 	assert ( ( len & ( ARBEL_PAGE_SIZE - 1 ) ) == 0 );
1975
+	assert ( len != 0 );
1975 1976
 
1976 1977
 	/* Calculate starting points */
1977 1978
 	start = pa;

Loading…
取消
儲存