stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Patch "cgroup: avoid false positive gcc-6 warning" has been added to the 4.4-stable tree
@ 2016-11-09 10:08 gregkh
  0 siblings, 0 replies; only message in thread
From: gregkh @ 2016-11-09 10:08 UTC (permalink / raw)
  To: arnd, gregkh, tj; +Cc: stable, stable-commits


This is a note to let you know that I've just added the patch titled

    cgroup: avoid false positive gcc-6 warning

to the 4.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     cgroup-avoid-false-positive-gcc-6-warning.patch
and it can be found in the queue-4.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


>From cfe02a8a973e7e5f66926b8ae38dfce404b19e29 Mon Sep 17 00:00:00 2001
From: Arnd Bergmann <arnd@arndb.de>
Date: Tue, 15 Mar 2016 00:21:06 +0100
Subject: cgroup: avoid false positive gcc-6 warning

From: Arnd Bergmann <arnd@arndb.de>

commit cfe02a8a973e7e5f66926b8ae38dfce404b19e29 upstream.

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>
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 kernel/cgroup.c |    3 +++
 1 file changed, 3 insertions(+)

--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -236,6 +236,9 @@ static int cgroup_addrm_files(struct cgr
  */
 static bool cgroup_ssid_enabled(int ssid)
 {
+	if (CGROUP_SUBSYS_COUNT == 0)
+		return false;
+
 	return static_key_enabled(cgroup_subsys_enabled_key[ssid]);
 }
 


Patches currently in stable-queue which might be from arnd@arndb.de are

queue-4.4/drm-exynos-fix-error-handling-in-exynos_drm_subdrv_open.patch
queue-4.4/arm-8584-1-floppy-avoid-gcc-6-warning.patch
queue-4.4/powerpc-ptrace-fix-out-of-bounds-array-access-warning.patch
queue-4.4/cgroup-avoid-false-positive-gcc-6-warning.patch
queue-4.4/smc91x-avoid-self-comparison-warning.patch

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-11-09 10:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-09 10:08 Patch "cgroup: avoid false positive gcc-6 warning" has been added to the 4.4-stable tree gregkh

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).