summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMarcin Slusarz <marcin.slusarz@gmail.com>2009-09-22 02:04:29 +0200
committerLinus Torvalds <torvalds@linux-foundation.org>2009-09-22 16:17:47 +0200
commit2f30b1f9e1b612cdd1a17daeecf514229e8d6a5f (patch)
tree78be4b31e0fee84c34bcd53270257290098ee058 /lib
parentMAINTAINERS: move ARM lists to infradead (diff)
downloadlinux-2f30b1f9e1b612cdd1a17daeecf514229e8d6a5f.tar.xz
linux-2f30b1f9e1b612cdd1a17daeecf514229e8d6a5f.zip
vsprintf: use WARN_ON_ONCE
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com> Reviewed-by: Frederic Weisbecker <fweisbec@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/vsprintf.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index d320c1816a7b..73a14b8c6d1f 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -1092,13 +1092,8 @@ int vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
/* Reject out-of-range values early. Large positive sizes are
used for unknown buffer sizes. */
- if (unlikely((int) size < 0)) {
- /* There can be only one.. */
- static char warn = 1;
- WARN_ON(warn);
- warn = 0;
+ if (WARN_ON_ONCE((int) size < 0))
return 0;
- }
str = buf;
end = buf + size;
@@ -1544,13 +1539,8 @@ int bstr_printf(char *buf, size_t size, const char *fmt, const u32 *bin_buf)
struct printf_spec spec = {0};
- if (unlikely((int) size < 0)) {
- /* There can be only one.. */
- static char warn = 1;
- WARN_ON(warn);
- warn = 0;
+ if (WARN_ON_ONCE((int) size < 0))
return 0;
- }
str = buf;
end = buf + size;