Browse Source

[hermon] 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 years ago
parent
commit
dea5b74475
1 changed files with 1 additions and 0 deletions
  1. 1
    0
      src/drivers/infiniband/hermon.c

+ 1
- 0
src/drivers/infiniband/hermon.c View File

2113
 	assert ( ( va & ( HERMON_PAGE_SIZE - 1 ) ) == 0 );
2113
 	assert ( ( va & ( HERMON_PAGE_SIZE - 1 ) ) == 0 );
2114
 	assert ( ( pa & ( HERMON_PAGE_SIZE - 1 ) ) == 0 );
2114
 	assert ( ( pa & ( HERMON_PAGE_SIZE - 1 ) ) == 0 );
2115
 	assert ( ( len & ( HERMON_PAGE_SIZE - 1 ) ) == 0 );
2115
 	assert ( ( len & ( HERMON_PAGE_SIZE - 1 ) ) == 0 );
2116
+	assert ( len != 0 );
2116
 
2117
 
2117
 	/* Calculate starting points */
2118
 	/* Calculate starting points */
2118
 	start = pa;
2119
 	start = pa;

Loading…
Cancel
Save