From: Joe Perches <joe@perches.com>
To: Christoph Jaeger <christophjaeger@linux.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] module: fix sprintf format specifier in param_get_byte()
Date: Tue, 06 Aug 2013 16:39:53 -0700 [thread overview]
Message-ID: <1375832393.2424.47.camel@joe-AO722> (raw)
In-Reply-To: <1375823532-24153-1-git-send-email-christophjaeger@linux.com>
On Tue, 2013-08-06 at 23:12 +0200, Christoph Jaeger wrote:
> In param_get_byte(), to which the macro STANDARD_PARAM_DEF(byte, ...) expands,
> "%c" is used to print an unsigned char. So it gets printed as a character what
> is not intended here. Use "%hhu" instead.
>
> Signed-off-by: Christoph Jaeger <christophjaeger@linux.com>
> ---
> kernel/params.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/params.c b/kernel/params.c
> index 440e65d..59f7ac7 100644
> --- a/kernel/params.c
> +++ b/kernel/params.c
> @@ -252,7 +252,7 @@ int parse_args(const char *doing,
> EXPORT_SYMBOL(param_ops_##name)
>
>
> -STANDARD_PARAM_DEF(byte, unsigned char, "%c", unsigned long, strict_strtoul);
> +STANDARD_PARAM_DEF(byte, unsigned char, "%hhu", unsigned long, strict_strtoul);
> STANDARD_PARAM_DEF(short, short, "%hi", long, strict_strtol);
> STANDARD_PARAM_DEF(ushort, unsigned short, "%hu", unsigned long, strict_strtoul);
I don't see the point of using "%hh[ui]" and "%h[ui]".
These are promoted to int/unsigned int for the sprintf anyway.
I'd just use %d and %u instead.
next prev parent reply other threads:[~2013-08-06 23:39 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-06 21:12 Christoph Jaeger
2013-08-06 23:39 ` Joe Perches [this message]
2013-08-07 6:43 ` Rusty Russell
2013-08-07 11:31 ` Michal Nazarewicz
2013-08-07 16:45 ` Jon Mason
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=1375832393.2424.47.camel@joe-AO722 \
--to=joe@perches.com \
--cc=christophjaeger@linux.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rusty@rustcorp.com.au \
/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
all inboxes | Powered by JetHome®