Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0b030c2c authored by Andi Kleen's avatar Andi Kleen Committed by Linus Torvalds
Browse files

Fix bitmap_scnlistprintf for empty masks



When a bitmap is empty bitmap_scnlistprintf() would leave the buffer
uninitialized.  Set it to an empty string in this case.

I didn't see any in normal kernel callers hitting this, but some custom
debug code of mine did.

Signed-off-by: default avatarAndi Kleen <ak@suse.de>
Acked-by: default avatarPaul Jackson <pj@sgi.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 5a75983e
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -469,6 +469,10 @@ int bitmap_scnlistprintf(char *buf, unsigned int buflen,
	/* current bit is 'cur', most recently seen range is [rbot, rtop] */
	/* current bit is 'cur', most recently seen range is [rbot, rtop] */
	int cur, rbot, rtop;
	int cur, rbot, rtop;


	if (buflen == 0)
		return 0;
	buf[0] = 0;

	rbot = cur = find_first_bit(maskp, nmaskbits);
	rbot = cur = find_first_bit(maskp, nmaskbits);
	while (cur < nmaskbits) {
	while (cur < nmaskbits) {
		rtop = cur;
		rtop = cur;