lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1375832393.2424.47.camel@joe-AO722>
Date:	Tue, 06 Aug 2013 16:39:53 -0700
From:	Joe Perches <joe@...ches.com>
To:	Christoph Jaeger <christophjaeger@...ux.com>
Cc:	Rusty Russell <rusty@...tcorp.com.au>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/1] module: fix sprintf format specifier in
 param_get_byte()

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@...ux.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.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ