From: David Laight <david.laight.linux@gmail.com>
To: Thorsten Blum <thorsten.blum@linux.dev>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Petr Mladek <pmladek@suse.com>,
Steven Rostedt <rostedt@goodmis.org>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Rasmus Villemoes <linux@rasmusvillemoes.dk>,
Sergey Senozhatsky <senozhatsky@chromium.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] lib/vsprintf: use bool for local decode variable
Date: Tue, 7 Apr 2026 20:29:27 +0100 [thread overview]
Message-ID: <20260407202927.24d757eb@pumpkin> (raw)
In-Reply-To: <20260407181835.1053072-2-thorsten.blum@linux.dev>
On Tue, 7 Apr 2026 20:18:36 +0200
Thorsten Blum <thorsten.blum@linux.dev> wrote:
> The local variable 'decode' is only used as a boolean value - change its
> data type from int to bool accordingly.
Hopefully the compiler actually does:
int decode = fmt[0];
and then compares against 'R' later on.
But this change ought to make absolutely no difference to the code.
David
>
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> ---
> lib/vsprintf.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/lib/vsprintf.c b/lib/vsprintf.c
> index 800b8ac49f53..9f359b31c8d1 100644
> --- a/lib/vsprintf.c
> +++ b/lib/vsprintf.c
> @@ -1107,7 +1107,7 @@ char *resource_string(char *buf, char *end, struct resource *res,
> 2*RSRC_BUF_SIZE + FLAG_BUF_SIZE + RAW_BUF_SIZE)];
>
> char *p = sym, *pend = sym + sizeof(sym);
> - int decode = (fmt[0] == 'R') ? 1 : 0;
> + bool decode = fmt[0] == 'R';
> const struct printf_spec *specp;
>
> if (check_pointer(&buf, end, res, spec))
> @@ -1132,7 +1132,7 @@ char *resource_string(char *buf, char *end, struct resource *res,
> } else {
> p = string_nocheck(p, pend, "??? ", str_spec);
> specp = &mem_spec;
> - decode = 0;
> + decode = false;
> }
> if (decode && res->flags & IORESOURCE_UNSET) {
> p = string_nocheck(p, pend, "size ", str_spec);
>
next prev parent reply other threads:[~2026-04-07 19:29 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-07 18:18 [PATCH] lib/vsprintf: use bool for local decode variable Thorsten Blum
2026-04-07 19:29 ` David Laight [this message]
2026-04-08 7:53 ` Petr Mladek
2026-04-08 13:18 ` Andy Shevchenko
2026-04-14 14:25 ` Petr Mladek
2026-04-14 15:36 ` Thorsten Blum
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=20260407202927.24d757eb@pumpkin \
--to=david.laight.linux@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@rasmusvillemoes.dk \
--cc=pmladek@suse.com \
--cc=rostedt@goodmis.org \
--cc=senozhatsky@chromium.org \
--cc=thorsten.blum@linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.