From: Tejun Heo <tj@kernel.org>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Li Zefan <lizefan@huawei.com>,
Johannes Weiner <hannes@cmpxchg.org>,
Aditya Kali <adityakali@google.com>,
Aleksa Sarai <cyphar@cyphar.com>,
cgroups@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] cgroup: avoid false positive gcc-6 warning
Date: Wed, 16 Mar 2016 13:33:09 -0700 [thread overview]
Message-ID: <20160316203309.GF21104@mtj.duckdns.org> (raw)
In-Reply-To: <1457997681-2011105-1-git-send-email-arnd@arndb.de>
On Tue, Mar 15, 2016 at 12:21:06AM +0100, Arnd Bergmann wrote:
> When all subsystems are disabled, gcc notices that cgroup_subsys_enabled_key
> is a zero-length array and that any access to it must be out of bounds:
>
> In file included from ../include/linux/cgroup.h:19:0,
> from ../kernel/cgroup.c:31:
> ../kernel/cgroup.c: In function 'cgroup_add_cftypes':
> ../kernel/cgroup.c:261:53: error: array subscript is above array bounds [-Werror=array-bounds]
> return static_key_enabled(cgroup_subsys_enabled_key[ssid]);
> ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
> ../include/linux/jump_label.h:271:40: note: in definition of macro 'static_key_enabled'
> static_key_count((struct static_key *)x) > 0; \
> ^
>
> We should never call the function in this particular case, so this is
> not a bug. In order to silence the warning, this adds an explicit check
> for the CGROUP_SUBSYS_COUNT==0 case.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Applied to cgroup/for-4.6.
Thanks.
--
tejun
prev parent reply other threads:[~2016-03-16 20:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-14 23:21 Arnd Bergmann
2016-03-16 20:33 ` Tejun Heo [this message]
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=20160316203309.GF21104@mtj.duckdns.org \
--to=tj@kernel.org \
--cc=adityakali@google.com \
--cc=arnd@arndb.de \
--cc=cgroups@vger.kernel.org \
--cc=cyphar@cyphar.com \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lizefan@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
all inboxes | Powered by JetHome®