lkml.org 
[lkml]   [2009]   [Aug]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH resend] vsprintf: use WARN_ON_ONCE
From: Marcin Slusarz <marcin.slusarz@gmail.com>
Subject: vsprintf: use WARN_ON_ONCE

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>

diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 756ccaf..a63bb18 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -983,13 +983,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;
@@ -1439,13 +1434,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;

\
 
 \ /
  Last update: 2009-08-23 20:31    [W:0.033 / U:23.468 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site