From: Jani Nikula <jani.nikula@linux.intel.com>
To: Kees Cook <keescook@chromium.org>,
Andrew Morton <akpm@linux-foundation.org>
Cc: Tony Lindgren <tony@atomide.com>,
Russell King <linux@armlinux.org.uk>,
"Maciej W. Rozycki" <macro@linux-mips.org>,
Ralf Baechle <ralf@linux-mips.org>, Arnd Bergmann <arnd@arndb.de>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rjw@rjwysocki.net>,
Viresh Kumar <viresh.kumar@linaro.org>,
Daniel Vetter <daniel.vetter@intel.com>,
Sean Paul <seanpaul@chromium.org>,
David Airlie <airlied@linux.ie>,
Yisen Zhuang <yisen.zhuang@huawei.com>,
Salil Mehta <salil.mehta@huawei.com>,
Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
Jes Sorensen <jes@trained-monkey.org>,
Jiri Slaby <jslaby@suse.com>,
Patrice Chotard <patrice.chotard@st.com>,
"David S. Miller" <davem@davemloft.net>,
James Hogan <james.hogan@imgtec.com>,
Paul Burton <paul.burton@imgtec.com>,
Matt Redfearn <matt.redfearn@imgtec.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Ingo Molnar <mingo@kernel.org>,
Rasmus Villemoes <linux@rasmusvillemoes.dk>,
Mugunthan V N <mugunthanvnm@ti.com>,
Felipe Balbi <felipe.balbi@linux.intel.com>,
Jarod Wilson <jarod@redhat.com>, Florian Westphal <fw@strlen.de>,
Antonio Quartulli <a@unstable.cc>,
Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Kejian Yan <yankejian@huawei.com>,
Daode Huang <huangdaode@hisilicon.com>,
Qianqian Xie <xieqianqian@huawei.com>,
Philippe Reynes <tremyfr@gmail.com>,
Colin Ian King <colin.king@canonical.com>,
Eric Dumazet <edumazet@google.com>,
Christian Gromm <christian.gromm@microchip.com>,
Andrey Shvetsov <andrey.shvetsov@k2l.de>,
Jason Litzinger <jlitzingerdev@gmail.com>,
WANG Cong <xiyou.wangcong@gmail.com>,
linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org,
linux-mips@linux-mips.org, linux-pm@vger.kernel.org,
dri-devel@lists.freedesktop.org, netdev@vger.kernel.org,
linux-hippi@sunsite.dk, devel@driverdev.osuosl.org,
kernel@stlinux.com, linux-serial@vger.kernel.org,
linux-decnet-user@lists.sourceforge.net,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] format-security: move static strings to const
Date: Thu, 06 Apr 2017 11:48:48 +0300 [thread overview]
Message-ID: <87mvbtzztb.fsf@intel.com> (raw)
In-Reply-To: <20170405214711.GA5711@beast>
On Thu, 06 Apr 2017, Kees Cook <keescook@chromium.org> wrote:
> While examining output from trial builds with -Wformat-security enabled,
> many strings were found that should be defined as "const", or as a char
> array instead of char pointer. This makes some static analysis easier,
> by producing fewer false positives.
>
> As these are all trivial changes, it seemed best to put them all in
> a single patch rather than chopping them up per maintainer.
> diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
> index f6d4d9700734..1ff9d5912b83 100644
> --- a/drivers/gpu/drm/drm_fb_helper.c
> +++ b/drivers/gpu/drm/drm_fb_helper.c
> @@ -2331,7 +2331,7 @@ EXPORT_SYMBOL(drm_fb_helper_hotplug_event);
> int __init drm_fb_helper_modinit(void)
> {
> #if defined(CONFIG_FRAMEBUFFER_CONSOLE_MODULE) && !defined(CONFIG_EXPERT)
> - const char *name = "fbcon";
> + const char name[] = "fbcon";
I'd always write the former out of habit. Why should I start using the
latter? What makes it better?
What keeps the kernel from accumulating tons more of the former?
Here's an interesting comparison of the generated code. I'm a bit
surprised by what gcc does, I would have expected no difference, like
clang. https://godbolt.org/g/OdqUvN
The other changes adding const in this patch are, of course, good.
BR,
Jani.
--
Jani Nikula, Intel Open Source Technology Center
next prev parent reply other threads:[~2017-04-06 8:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-05 21:47 [PATCH] format-security: move static strings to const Kees Cook
2017-04-06 8:27 ` Daniel Vetter
2017-04-06 8:48 ` Jani Nikula [this message]
2017-04-07 3:21 ` Kees Cook
2017-04-07 3:21 ` Kees Cook
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=87mvbtzztb.fsf@intel.com \
--to=jani.nikula@linux.intel.com \
--cc=a@unstable.cc \
--cc=airlied@linux.ie \
--cc=akpm@linux-foundation.org \
--cc=andrey.shvetsov@k2l.de \
--cc=arnd@arndb.de \
--cc=christian.gromm@microchip.com \
--cc=colin.king@canonical.com \
--cc=daniel.vetter@intel.com \
--cc=davem@davemloft.net \
--cc=devel@driverdev.osuosl.org \
--cc=dmitry.torokhov@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=edumazet@google.com \
--cc=felipe.balbi@linux.intel.com \
--cc=fw@strlen.de \
--cc=gregkh@linuxfoundation.org \
--cc=huangdaode@hisilicon.com \
--cc=james.hogan@imgtec.com \
--cc=jarod@redhat.com \
--cc=jes@trained-monkey.org \
--cc=jlitzingerdev@gmail.com \
--cc=jslaby@suse.com \
--cc=keescook@chromium.org \
--cc=kernel@stlinux.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-decnet-user@lists.sourceforge.net \
--cc=linux-hippi@sunsite.dk \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@linux-mips.org \
--cc=linux-omap@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=linux@rasmusvillemoes.dk \
--cc=macro@linux-mips.org \
--cc=matt.redfearn@imgtec.com \
--cc=mingo@kernel.org \
--cc=mugunthanvnm@ti.com \
--cc=netdev@vger.kernel.org \
--cc=patrice.chotard@st.com \
--cc=paul.burton@imgtec.com \
--cc=pbonzini@redhat.com \
--cc=ralf@linux-mips.org \
--cc=rjw@rjwysocki.net \
--cc=salil.mehta@huawei.com \
--cc=seanpaul@chromium.org \
--cc=tony@atomide.com \
--cc=tremyfr@gmail.com \
--cc=tsbogend@alpha.franken.de \
--cc=viresh.kumar@linaro.org \
--cc=xieqianqian@huawei.com \
--cc=xiyou.wangcong@gmail.com \
--cc=yankejian@huawei.com \
--cc=yisen.zhuang@huawei.com \
/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;
as well as URLs for NNTP newsgroup(s).