Skip to content

Commit

Permalink
[arbel] Assert that mapping length is non-zero
Browse files Browse the repository at this point in the history
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 7495813 commit 0ced99e
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/drivers/infiniband/arbel.c
Expand Up @@ -1972,6 +1972,7 @@ static int arbel_map_vpm ( struct arbel *arbel,
assert ( ( va & ( ARBEL_PAGE_SIZE - 1 ) ) == 0 );
assert ( ( pa & ( ARBEL_PAGE_SIZE - 1 ) ) == 0 );
assert ( ( len & ( ARBEL_PAGE_SIZE - 1 ) ) == 0 );
assert ( len != 0 );

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

0 comments on commit 0ced99e

Please sign in to comment.