From patchwork Fri Oct 5 14:55:21 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 1553671 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id EB761DF24C for ; Fri, 5 Oct 2012 15:00:54 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TK9LZ-0004Jn-Kd; Fri, 05 Oct 2012 14:57:49 +0000 Received: from moutng.kundenserver.de ([212.227.17.8]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TK9Jp-0003bi-BR for linux-arm-kernel@lists.infradead.org; Fri, 05 Oct 2012 14:56:09 +0000 Received: from klappe2.boeblingen.de.ibm.com (deibp9eh1--blueice3n2.emea.ibm.com [195.212.29.180]) by mrelayeu.kundenserver.de (node=mreu3) with ESMTP (Nemesis) id 0Lirr0-1TpMjd3THK-00dCzi; Fri, 05 Oct 2012 16:55:48 +0200 From: Arnd Bergmann To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 07/16] cgroup: fix warning when building without any subsys Date: Fri, 5 Oct 2012 16:55:21 +0200 Message-Id: <1349448930-23976-8-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 1.7.10 In-Reply-To: <1349448930-23976-1-git-send-email-arnd@arndb.de> References: <1349448930-23976-1-git-send-email-arnd@arndb.de> X-Provags-ID: V02:K0:LE5XuEYuxrwkJLoRKhGJEQRYTOsl099eovMV8WrcDl/ FHv6vqGM707U3J7JNo/XoRUKO58d75UtmW6rAMQDN/LodvRRTq kpBZYhPK2nQ0WQ4vb0c0Tw0G8oQ36S/C8k7FzucW7URB1GwR+B 8kjLiZ+FMen0JSLRtSU90ZVtRJWpr4wCCyvPHUKFHeqVKvivqA e2dn0y4pngBlMdGhWSJy3o5dJ2SA12W1muzfx3r1lJqmSJxtvA Ovux/4ohZ2tm1fGtufRKLV9W9wQ9z68LSzs/OFd/Ur2r0uSkPN DiSx0b/b8kqMlsiyMrK5q525tLEmwHHBTTKAd6IvI2rlblLNzE nryaVaNKeSYcL65s6MtTmZP3aNjgM6ns8PlB67O38OkqvIhibQ PQlkS1WC8rGxAUNiZR3AJaGg5DQyc/aH6E= X-Spam-Note: CRM114 invocation failed X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [212.227.17.8 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: arm@kernel.org, Arnd Bergmann , Ben Blum , linux-kernel@vger.kernel.org, Li Zefan , Tejun Heo X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org In a configuration where the base cgroup support is enabled but every single cgroup subsys is turned off, CGROUP_BUILTIN_SUBSYS_COUNT is zero, which causes the sanity check code in cgroup_load_subsys to trigger: BUG_ON(ss->subsys_id >= CGROUP_BUILTIN_SUBSYS_COUNT); BUG_ON(subsys[ss->subsys_id] != ss); Gcc first confirms that subsys_id cannot be 0 or larger and consequently warns in the second line. kernel/cgroup.c: In function 'cgroup_load_subsys': kernel/cgroup.c:4326:38: warning: array subscript is below array bounds [-Warray-bounds] Since the subsys_id can never be less than zero, we can just change the type to an unsigned int, which makes the warning go away. Found by building ARM cns3420vb_defconfig. Signed-off-by: Arnd Bergmann Cc: Tejun Heo Cc: Li Zefan Cc: Ben Blum Acked-by: Ben Blum --- include/linux/cgroup.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h index c90eaa8..26b99df 100644 --- a/include/linux/cgroup.h +++ b/include/linux/cgroup.h @@ -475,7 +475,7 @@ struct cgroup_subsys { void (*post_clone)(struct cgroup *cgrp); void (*bind)(struct cgroup *root); - int subsys_id; + unsigned int subsys_id; int active; int disabled; int early_init;