axmap: return early of an overlap results in 0 settable bits
authorJens Axboe <axboe@kernel.dk>
Thu, 23 Aug 2018 18:22:10 +0000 (12:22 -0600)
committerJens Axboe <axboe@kernel.dk>
Thu, 23 Aug 2018 18:22:10 +0000 (12:22 -0600)
Reported-by: Bart Van Assche <bart.vanassche@wdc.com>
Fixes: 15a4f49 ("lib/axmap: Simplify axmap_set_fn()")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
lib/axmap.c

index e194e807ac542ee8068164e95f8977f7152b39cf..03e712f53be7a7623f90b12a3eecf57d73fc6f62 100644 (file)
@@ -241,6 +241,8 @@ static bool axmap_set_fn(struct axmap_level *al, unsigned long offset,
 
        if (overlap) {
                nr_bits = ffz(~overlap) - bit;
+               if (!nr_bits)
+                       return true;
                mask = bit_masks[nr_bits] << bit;
        }