From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755836AbcCPUdP (ORCPT ); Wed, 16 Mar 2016 16:33:15 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:35617 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751051AbcCPUdL (ORCPT ); Wed, 16 Mar 2016 16:33:11 -0400 Date: Wed, 16 Mar 2016 13:33:09 -0700 From: Tejun Heo To: Arnd Bergmann Cc: Li Zefan , Johannes Weiner , Aditya Kali , Aleksa Sarai , cgroups@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] cgroup: avoid false positive gcc-6 warning Message-ID: <20160316203309.GF21104@mtj.duckdns.org> References: <1457997681-2011105-1-git-send-email-arnd@arndb.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1457997681-2011105-1-git-send-email-arnd@arndb.de> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Applied to cgroup/for-4.6. Thanks. -- tejun