From 49e1ade14949b737dbd111b19a4057faf9aa77bb Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Thu, 23 Aug 2018 12:22:10 -0600 Subject: [PATCH] axmap: return early of an overlap results in 0 settable bits Reported-by: Bart Van Assche Fixes: 15a4f49 ("lib/axmap: Simplify axmap_set_fn()") Signed-off-by: Jens Axboe --- lib/axmap.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/axmap.c b/lib/axmap.c index e194e807..03e712f5 100644 --- a/lib/axmap.c +++ b/lib/axmap.c @@ -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; } -- 2.25.1