From dea5b744750f691c071b018b1084fa916ed630a8 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Wed, 22 Mar 2017 15:18:54 +0200 Subject: [PATCH] [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 --- src/drivers/infiniband/hermon.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/drivers/infiniband/hermon.c b/src/drivers/infiniband/hermon.c index 3797d96e..a1d2a3bd 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;