Received: by 2002:a5d:925a:0:0:0:0:0 with SMTP id e26csp1380282iol; Fri, 10 Jun 2022 06:25:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw2SBGSZnlSKycFAzs21z1W0qj60+U3BOAE0po0zT/Dsxl8liAoJdE+aPdP3ak7SX9po4fi X-Received: by 2002:a17:907:86a6:b0:6ff:21f0:9e5a with SMTP id qa38-20020a17090786a600b006ff21f09e5amr40039892ejc.164.1654867556375; Fri, 10 Jun 2022 06:25:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654867556; cv=none; d=google.com; s=arc-20160816; b=sb4cODQuXsAlB4HgPhtb8lYrmjxD5RENODBOkk+s0I4Kok0rGCu8Ot0rslcruOc1bW jww4hs8sJM6rABPGyUnsZymrYzNkI+XuaAwnrPvj1uqsnbbtS+irONvHDRZEoVuZT82e GrQo1XdOX59kbL+1HlPVfk0pSGECpqQ2fqWbaJXPLoebiWo/tfOFS+JZ/zeJBGV3mz0F G9wQCeIjpRWadyIqBN/COnl4g0o5iykTjlHxDKbBwrgd6NrZkI2lmMsyFASgS6LOiYU7 r641x0vMstoF+MoU8mSnswJs26NnosyI/nDsgxyzPWAvKt6IFoKS5JvxXijndwnoEl/4 2mnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id; bh=USb0UBjMUqXV/ClHjL+J0+mzTM7yjpbT66qAk0lDhV8=; b=X+UydR6zyzWi40GkDQdn3TkudXT3H1T9cBhOH3F0WCro7hlz91HRgH50l9qI8RxfXR ldqXotCbIadK51hkoYGFEGFClfpmaOJFbMc0IE94N052FXzZW1sBHkIu4rvgz1R4xwhQ xRKixcTFnNhZYs+9cvc1Tji4IzNiZFi6Be6VfbXVpPEc2zlUCn2rn0FUwuP0KarZscIP E/HOKCupCpV7YZqRPyi4xGe1RrhaZN9OW1AXvtc6rJkB0TYrbSALvZ8R1ZhmBjJsdDeH E5gSZWT7u56bnxHoq+nFk03juoSQAYwtcdCgPWad0WziaFyF+kD7SJfuL2/xVHQtu5kF olDg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dz14-20020a0564021d4e00b0042df92502a1si2623053edb.329.2022.06.10.06.25.29; Fri, 10 Jun 2022 06:25:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234848AbiFJMoj convert rfc822-to-8bit (ORCPT + 99 others); Fri, 10 Jun 2022 08:44:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47276 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229608AbiFJMoi (ORCPT ); Fri, 10 Jun 2022 08:44:38 -0400 Received: from relay5.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4E5D18E; Fri, 10 Jun 2022 05:44:35 -0700 (PDT) Received: from omf09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay12.hostedemail.com (Postfix) with ESMTP id 06E07121083; Fri, 10 Jun 2022 12:44:30 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: joe@perches.com) by omf09.hostedemail.com (Postfix) with ESMTPA id 08E1F2002A; Fri, 10 Jun 2022 12:44:18 +0000 (UTC) Message-ID: Subject: Re: [PATCH 00/12] Clang -Wformat warning fixes From: Joe Perches To: Greg Kroah-Hartman , Bill Wendling Cc: Jan Engelhardt , Andrew Morton , Bill Wendling , Tony Luck , Borislav Petkov , Thomas Gleixner , Ingo Molnar , Dave Hansen , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , "H. Peter Anvin" , Phillip Potter , Arnd Bergmann , "Rafael J. Wysocki" , Jan Kara , Pablo Neira Ayuso , Jozsef Kadlecsik , Florian Westphal , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jaroslav Kysela , Takashi Iwai , Nathan Chancellor , Nick Desaulniers , Tom Rix , Ross Philipson , Daniel Kiper , linux-edac@vger.kernel.org, LKML , ACPI Devel Maling List , linux-mm@kvack.org, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, Networking , alsa-devel@alsa-project.org, clang-built-linux Date: Fri, 10 Jun 2022 05:44:18 -0700 In-Reply-To: References: <20220609221702.347522-1-morbo@google.com> <20220609152527.4ad7862d4126e276e6f76315@linux-foundation.org> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8BIT User-Agent: Evolution 3.44.1-0ubuntu1 MIME-Version: 1.0 X-Rspamd-Server: rspamout05 X-Rspamd-Queue-Id: 08E1F2002A X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS, SPF_NONE,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=no autolearn_force=no version=3.4.6 X-Stat-Signature: r8ecgxf89uwg9qffzdumnqfsj56kpo1p X-Session-Marker: 6A6F6540706572636865732E636F6D X-Session-ID: U2FsdGVkX19T013fSZHIO4BR28mlFWzRzi2PPI2hbJs= X-HE-Tag: 1654865058-93434 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2022-06-10 at 07:20 +0200, Greg Kroah-Hartman wrote: > On Thu, Jun 09, 2022 at 04:16:16PM -0700, Bill Wendling wrote: > > On Thu, Jun 9, 2022 at 4:03 PM Jan Engelhardt wrote: > > > On Friday 2022-06-10 00:49, Bill Wendling wrote: > > > > On Thu, Jun 9, 2022 at 3:25 PM Andrew Morton wrote: > > > > > On Thu, 9 Jun 2022 22:16:19 +0000 Bill Wendling wrote: > > > > > > > > > > > This patch set fixes some clang warnings when -Wformat is enabled. > > > > > > > > > > tldr: > > > > > > > > > > - printk(msg); > > > > > + printk("%s", msg); > > > > > > > > > > Otherwise these changes are a > > > > > useless consumer of runtime resources. > > > > Calling a "printf" style function is already insanely expensive. I expect the printk code itself dominates, not the % scan cost. > > > Perhaps you can split vprintk_store in the middle (after the call to > > > vsnprintf), and offer the second half as a function of its own (e.g. > > > "puts"). Then the tldr could be > > > > > > - printk(msg); > > > + puts(msg); > > > > That might be a nice compromise. Andrew, what do you think? > > You would need to do that for all of the dev_printk() variants, so I > doubt that would ever be all that useful as almost no one should be > using a "raw" printk() these days. True. The kernel has ~20K variants like that. $ git grep -P '\b(?:(?:\w+_){1,3}(?:alert|emerg|crit|err|warn|notice|info|cont|debug|dbg)|printk)\s*\(".*"\s*\)\s*;' | wc -l 21160 That doesn't include the ~3K uses like #define foo "bar" printk(foo); $ git grep -P '\b(?:(?:\w+_){1,3}(?:alert|emerg|crit|err|warn|info|notice|debug|dbg|cont)|printk)\s*\((?:\s*\w+){1,3}\s*\)\s*;'|wc -l 2922 There are apparently only a few hundred uses of variants like: printk("%s", foo) $ git grep -P '\b(?:(?:\w+_){1,3}(?:alert|emerg|crit|err|warn|info|notice|debug|dbg|cont)|printk)\s*\(\s*"%s(?:\\n)?"\s*,\s*(?:".*"|\w+)\s*\)\s*;' | wc -l 305 unless I screwed up my greps (which of course is quite possible)