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 <jbeulich@novell.com>
Signed-off-by: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>



git-svn-id: https://irqbalance.googlecode.com/svn/trunk@26 46b42954-3823-0410-bd82-eb80b452c9b5
This commit is contained in:
nhorman 2010-06-01 18:32:32 +00:00
parent 7cd766c0f4
commit 3a7d9c642f
1 changed files with 1 additions and 1 deletions

View File

@ -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;