summaryrefslogtreecommitdiff
path: root/lib/bitmap.c
diff options
context:
space:
mode:
authorAndrew Morton <akpm@osdl.org>2004-02-18 04:49:34 -0800
committerLinus Torvalds <torvalds@ppc970.osdl.org>2004-02-18 04:49:34 -0800
commit01d1a791d1a13df17b649459eec6830f226c7163 (patch)
tree851c48c86a683ab46e89b9fff7b4fc9eba36cde1 /lib/bitmap.c
parent53b15b863e95defe1487a67e6ca5502a0b4d3e5f (diff)
[PATCH] snprintf fixes
From: Juergen Quade <quade@hsnr.de> Lots of places in the kernel are using [v]snprintf wrongly: they assume it returns the number of characters copied. It doesn't. It returns the number of characters which _would_ have been copied had the buffer not been filled up. So create new functions vscnprintf() and scnprintf() which have the expected (sane) semaptics, and migrate callers over to using them.
Diffstat (limited to 'lib/bitmap.c')
-rw-r--r--lib/bitmap.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/bitmap.c b/lib/bitmap.c
index 5e93a93c0136..1f1efb07b616 100644
--- a/lib/bitmap.c
+++ b/lib/bitmap.c
@@ -193,7 +193,7 @@ int bitmap_snprintf(char *buf, unsigned int buflen,
word = i / BITS_PER_LONG;
bit = i % BITS_PER_LONG;
val = (maskp[word] >> bit) & chunkmask;
- len += snprintf(buf+len, buflen-len, "%s%0*lx", sep,
+ len += scnprintf(buf+len, buflen-len, "%s%0*lx", sep,
(chunksz+3)/4, val);
chunksz = CHUNKSZ;
sep = ",";