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:
parent
7cd766c0f4
commit
3a7d9c642f
2
bitmap.c
2
bitmap.c
|
@ -275,7 +275,7 @@ int bitmap_scnprintf(char *buf, unsigned int buflen,
|
||||||
word = i / BITS_PER_LONG;
|
word = i / BITS_PER_LONG;
|
||||||
bit = i % BITS_PER_LONG;
|
bit = i % BITS_PER_LONG;
|
||||||
val = (maskp[word] >> bit) & chunkmask;
|
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,
|
len += snprintf(buf+len, buflen-len, "%s%0*lx", sep,
|
||||||
(chunksz+3)/4, val);
|
(chunksz+3)/4, val);
|
||||||
chunksz = CHUNKSZ;
|
chunksz = CHUNKSZ;
|
||||||
|
|
Loading…
Reference in a new issue