From patchwork Wed Feb 11 22:51:08 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 5814811 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 2E8F4BF440 for ; Wed, 11 Feb 2015 22:51:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5B0C92017E for ; Wed, 11 Feb 2015 22:51:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 675EA201CD for ; Wed, 11 Feb 2015 22:51:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754468AbbBKWvZ (ORCPT ); Wed, 11 Feb 2015 17:51:25 -0500 Received: from mail-la0-f41.google.com ([209.85.215.41]:42258 "EHLO mail-la0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754337AbbBKWvU (ORCPT ); Wed, 11 Feb 2015 17:51:20 -0500 Received: by labgf13 with SMTP id gf13so6561334lab.9 for ; Wed, 11 Feb 2015 14:51:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=from:to:cc:subject:date:message-id; bh=qAeCYskLcMAUBrjQeNCZdSJhTSbdKxwjdSHUxgk6wHI=; b=aOr8oKYLJ6ytb1MOHDAIoNanBms2slGB2YMNxTf+oPW+ANVlrYiKdUePlL+idqC7+o AD6smN1xisxhLaHZZQwm7DgeGzNchYV1XVlUZ3Z6DykDa/8HSfx7eaNQFzUbwB9qet57 BNHOa7m7JbHt/rQldfPb+SN7i0a0PjxFEybFs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=qAeCYskLcMAUBrjQeNCZdSJhTSbdKxwjdSHUxgk6wHI=; b=jdDNx+wfSLsSruK+f3wnVeJjQ/daXFVubk9aeNSsKwo53WTU8OT5IyfzZt8LDV07k8 zEvAzkFm5KE9HzlbZL26h45uKywhRwGWeHofapb5o9CzsCs6RDWWAEWNk+ncbsDrzQj5 fzzCZ829ml/+QL9FCL700caqtTMBdQdbjjl1D7uvFghmTBnzmaGjogfcEKd+RYYggvKY HJd9A44hUG/xHUBDbJsCACrNoVOaov3rchadVza8TjRRneJfpqqqlROGuYqACa3cvF7I s1Tr7e/KEQTyT9+tuEXP4PDLNRNvpXx9Kl80A8qaBukqfoLPM49hJXO/hUOtaCKwBUuw kq8w== X-Gm-Message-State: ALoCoQmz/CDL2gr+dhLZSLTk0Hj4rLG9TYHaF9KoceDlrl3k/XstLlOtWLaMc434wKXerg5yjVs/ X-Received: by 10.112.211.168 with SMTP id nd8mr853952lbc.18.1423695076508; Wed, 11 Feb 2015 14:51:16 -0800 (PST) Received: from spencer.imf.au.dk ([130.225.20.51]) by mx.google.com with ESMTPSA id jz4sm411525lbc.36.2015.02.11.14.51.15 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Feb 2015 14:51:15 -0800 (PST) From: Rasmus Villemoes To: Stanislaw Gruszka , Kalle Valo Cc: Rasmus Villemoes , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] iwl4965: Enable checking of format strings Date: Wed, 11 Feb 2015 23:51:08 +0100 Message-Id: <1423695069-23436-1-git-send-email-linux@rasmusvillemoes.dk> X-Mailer: git-send-email 2.1.3 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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"; +#define fmt_value " %-30s %10u\n" +#define fmt_table " %-30s %10u %10u %10u %10u\n" +#define fmt_header "%-32s current cumulative delta max\n" static int il4965_stats_flag(struct il_priv *il, char *buf, int bufsz)