From: Michael Brown Date: Wed, 22 Mar 2017 13:18:54 +0000 (+0200) Subject: [hermon] Assert that mapping length is non-zero X-Git-Tag: v1.20.1~257 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dea5b744750f691c071b018b1084fa916ed630a8;p=thirdparty%2Fipxe.git [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 --- diff --git a/src/drivers/infiniband/hermon.c b/src/drivers/infiniband/hermon.c index 3797d96e8..a1d2a3bd5 100644 --- a/src/drivers/infiniband/hermon.c +++ b/src/drivers/infiniband/hermon.c @@ -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;