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: <60178C37-F104-430E-92EB-B6DDFAEB2F99@intel.com>
Date:	Thu, 12 Feb 2015 00:41:39 +0000
From:	"Rustad, Mark D" <mark.d.rustad@...el.com>
To:	Rasmus Villemoes <linux@...musvillemoes.dk>
CC:	Stanislaw Gruszka <sgruszka@...hat.com>,
	Kalle Valo <kvalo@...eaurora.org>,
	"linux-wireless@...r.kernel.org" <linux-wireless@...r.kernel.org>,
	"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] iwl4965: Enable checking of format strings

On Feb 11, 2015, at 2:51 PM, Rasmus Villemoes <linux@...musvillemoes.dk> wrote:

> Since these fmt_* variables are just const char*, and not const
> char[], gcc (and smatch) doesn't to type checking of the arguments to
> the printf functions. Since the linker knows perfectly well to merge
> identical string constants, there's no point in having three static
> pointers waste memory and give an extra level of indirection.
> 
> This removes over 100 "non-constant format argument" warnings from
> smatch, accounting for about 20% of all such warnings in an
> allmodconfig.
> 
> Signed-off-by: Rasmus Villemoes <linux@...musvillemoes.dk>
> ---
> drivers/net/wireless/iwlegacy/4965-debug.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/wireless/iwlegacy/4965-debug.c b/drivers/net/wireless/iwlegacy/4965-debug.c
> index e0597bfdddb8..18855325cc1c 100644
> --- a/drivers/net/wireless/iwlegacy/4965-debug.c
> +++ b/drivers/net/wireless/iwlegacy/4965-debug.c
> @@ -28,10 +28,9 @@
> #include "common.h"
> #include "4965.h"
> 
> -static const char *fmt_value = "  %-30s %10u\n";
> -static const char *fmt_table = "  %-30s %10u  %10u  %10u  %10u\n";
> -static const char *fmt_header =
> -    "%-32s    current  cumulative       delta         max\n";

Why not change these to:
static const char fmt_value[] = "  %-30s %10u\n";
static const char fmt_table[] = "  %-30s %10u  %10u  %10u  %10u\n";
static const char fmt_header[] =
    "%-32s    current  cumulative       delta         max\n";

I think that is better than the macros and avoids the extra pointers that I agree are useless.

-- 
Mark Rustad, Networking Division, Intel Corporation


Download attachment "signature.asc" of type "application/pgp-signature" (842 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ