diff options
-rw-r--r-- | lib/bitmap.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/bitmap.c b/lib/bitmap.c index 26ebafa8c41d..2c9242e3fed0 100644 --- a/lib/bitmap.c +++ b/lib/bitmap.c | |||
@@ -469,6 +469,10 @@ int bitmap_scnlistprintf(char *buf, unsigned int buflen, | |||
469 | /* current bit is 'cur', most recently seen range is [rbot, rtop] */ | 469 | /* current bit is 'cur', most recently seen range is [rbot, rtop] */ |
470 | int cur, rbot, rtop; | 470 | int cur, rbot, rtop; |
471 | 471 | ||
472 | if (buflen == 0) | ||
473 | return 0; | ||
474 | buf[0] = 0; | ||
475 | |||
472 | rbot = cur = find_first_bit(maskp, nmaskbits); | 476 | rbot = cur = find_first_bit(maskp, nmaskbits); |
473 | while (cur < nmaskbits) { | 477 | while (cur < nmaskbits) { |
474 | rtop = cur; | 478 | rtop = cur; |