]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[hermon] 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:20:14 +0000 (15:20 +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/hermon.c

index 3797d96e89a002c6474a9f2b7ee419bde18ab653..a1d2a3bd585240a330fac730dd86feafd73fe3f8 100644 (file)
@@ -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;