]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[arbel] Assert that mapping length is non-zero
authorMichael Brown <mcb30@ipxe.org>
Wed, 22 Mar 2017 13:18:54 +0000 (15:18 +0200)
committerMichael Brown <mcb30@ipxe.org>
Wed, 22 Mar 2017 13:18:54 +0000 (15:18 +0200)
An (impossible) mapping length of zero produces a negative bit shift,
which is technically undefined.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/drivers/infiniband/arbel.c

index ea65d8b8d96e4a7fd0f0ee42e3922536978fe9f4..98a2b6010e3485096509de0d6ac47c37739e723b 100644 (file)
@@ -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;