diff options
author | Marcin Slusarz <marcin.slusarz@gmail.com> | 2009-09-21 20:04:29 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-09-22 10:17:47 -0400 |
commit | 2f30b1f9e1b612cdd1a17daeecf514229e8d6a5f (patch) | |
tree | 78be4b31e0fee84c34bcd53270257290098ee058 /lib | |
parent | efc03ecb9d674588a13aee27289c2af2afe5e6b4 (diff) |
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.c | 14 |
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) | |||
1092 | 1092 | ||
1093 | /* Reject out-of-range values early. Large positive sizes are | 1093 | /* Reject out-of-range values early. Large positive sizes are |
1094 | used for unknown buffer sizes. */ | 1094 | used for unknown buffer sizes. */ |
1095 | if (unlikely((int) size < 0)) { | 1095 | if (WARN_ON_ONCE((int) size < 0)) |
1096 | /* There can be only one.. */ | ||
1097 | static char warn = 1; | ||
1098 | WARN_ON(warn); | ||
1099 | warn = 0; | ||
1100 | return 0; | 1096 | return 0; |
1101 | } | ||
1102 | 1097 | ||
1103 | str = buf; | 1098 | str = buf; |
1104 | end = buf + size; | 1099 | end = buf + size; |
@@ -1544,13 +1539,8 @@ int bstr_printf(char *buf, size_t size, const char *fmt, const u32 *bin_buf) | |||
1544 | 1539 | ||
1545 | struct printf_spec spec = {0}; | 1540 | struct printf_spec spec = {0}; |
1546 | 1541 | ||
1547 | if (unlikely((int) size < 0)) { | 1542 | if (WARN_ON_ONCE((int) size < 0)) |
1548 | /* There can be only one.. */ | ||
1549 | static char warn = 1; | ||
1550 | WARN_ON(warn); | ||
1551 | warn = 0; | ||
1552 | return 0; | 1543 | return 0; |
1553 | } | ||
1554 | 1544 | ||
1555 | str = buf; | 1545 | str = buf; |
1556 | end = buf + size; | 1546 | end = buf + size; |