From a01af53a53232ab62ed23703db2714b438b90f89 Mon Sep 17 00:00:00 2001 From: Tony Battersby Date: Wed, 1 Oct 2014 12:20:28 -0400 Subject: [PATCH] Fix inconsequential bug in bitmap_scnprintf Fix incorrect code in bitmap_scnprintf that could cause it to give truncated output when nmaskbits > 32 and nmaskbits % 32 != 0. In practice this problem was never encountered because NR_CPUS % 32 == 0. So this change fixes the code for the sake of correctness even though the bug did not actually cause a real problem. --- bitmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bitmap.c b/bitmap.c index 4842b9d..2f44660 100644 --- a/bitmap.c +++ b/bitmap.c @@ -291,10 +291,10 @@ int bitmap_scnprintf(char *buf, unsigned int buflen, if (val!=0 || !first || i==0) { len += snprintf(buf+len, buflen-len, "%s%0*lx", sep, (chunksz+3)/4, val); - chunksz = CHUNKSZ; sep = ","; first = 0; } + chunksz = CHUNKSZ; } return len; }