From 3a7d9c642febd9b10d6d519c3f28f5886f5c8833 Mon Sep 17 00:00:00 2001 From: nhorman Date: Tue, 1 Jun 2010 18:32:32 +0000 Subject: [PATCH] Fix bitmap_scnprintf so that if the bitmask is all zeros, we print to our buffer correctly. Without this fix, the output buffer remains unititialized in this case Authored-by: Jan Beulich Signed-off-by: Jan Beulich Signed-off-by: Neil Horman git-svn-id: https://irqbalance.googlecode.com/svn/trunk@26 46b42954-3823-0410-bd82-eb80b452c9b5 --- bitmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bitmap.c b/bitmap.c index 1db7fa7..6a1ceae 100644 --- a/bitmap.c +++ b/bitmap.c @@ -275,7 +275,7 @@ int bitmap_scnprintf(char *buf, unsigned int buflen, word = i / BITS_PER_LONG; bit = i % BITS_PER_LONG; val = (maskp[word] >> bit) & chunkmask; - if (val!=0 || !first) { + if (val!=0 || !first || i==0) { len += snprintf(buf+len, buflen-len, "%s%0*lx", sep, (chunksz+3)/4, val); chunksz = CHUNKSZ;