Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[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>
  • Loading branch information
mcb30 committed Mar 22, 2017
1 parent 0ced99e commit dea5b74
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/drivers/infiniband/hermon.c
Expand Up @@ -2113,6 +2113,7 @@ static int hermon_map_vpm ( struct hermon *hermon,
assert ( ( va & ( HERMON_PAGE_SIZE - 1 ) ) == 0 );
assert ( ( pa & ( HERMON_PAGE_SIZE - 1 ) ) == 0 );
assert ( ( len & ( HERMON_PAGE_SIZE - 1 ) ) == 0 );
assert ( len != 0 );

/* Calculate starting points */
start = pa;
Expand Down

0 comments on commit dea5b74

Please sign in to comment.