From: Frederic Weisbecker <fweisbec@gmail.com>
To: Marcin Slusarz <marcin.slusarz@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
LKML <linux-kernel@vger.kernel.org>,
Mike Frysinger <vapier@gentoo.org>,
Lai Jiangshan <laijs@cn.fujitsu.com>
Subject: Re: [PATCH resend] vsprintf: use WARN_ON_ONCE
Date: Sun, 23 Aug 2009 21:43:28 +0200 [thread overview]
Message-ID: <20090823194327.GC6256@nowhere> (raw)
In-Reply-To: <4A918A64.9040201@gmail.com>
On Sun, Aug 23, 2009 at 08:28:52PM +0200, Marcin Slusarz wrote:
> From: Marcin Slusarz <marcin.slusarz@gmail.com>
> Subject: vsprintf: use WARN_ON_ONCE
>
> Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Reviewed-by: Frederic Weisbecker <fweisbec@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;
prev parent reply other threads:[~2009-08-23 19:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-23 18:28 [PATCH resend] vsprintf: use WARN_ON_ONCE Marcin Slusarz
2009-08-23 19:43 ` Frederic Weisbecker [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090823194327.GC6256@nowhere \
--to=fweisbec@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=laijs@cn.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=marcin.slusarz@gmail.com \
--cc=vapier@gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox