* [PATCH] Fix bitmap_scnlistprintf for empty masks
@ 2007-10-26 1:42 Andi Kleen
2007-10-26 2:00 ` Paul Jackson
0 siblings, 1 reply; 2+ messages in thread
From: Andi Kleen @ 2007-10-26 1:42 UTC (permalink / raw)
To: linux-kernel; +Cc: pj
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: Andi Kleen <ak@suse.de>
Index: linux-2.6.24-rc1-hack/lib/bitmap.c
===================================================================
--- linux-2.6.24-rc1-hack.orig/lib/bitmap.c
+++ linux-2.6.24-rc1-hack/lib/bitmap.c
@@ -469,6 +469,10 @@ int bitmap_scnlistprintf(char *buf, unsi
/* current bit is 'cur', most recently seen range is [rbot, rtop] */
int cur, rbot, rtop;
+ if (buflen == 0)
+ return 0;
+ buf[0] = 0;
+
rbot = cur = find_first_bit(maskp, nmaskbits);
while (cur < nmaskbits) {
rtop = cur;
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-10-26 2:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-26 1:42 [PATCH] Fix bitmap_scnlistprintf for empty masks Andi Kleen
2007-10-26 2:00 ` Paul Jackson
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.