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: 12010 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 8D74823E57 for ; Fri, 5 Oct 2012 14:56:02 +0000 (UTC) Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by fiordland.canonical.com (Postfix) with ESMTP id D997FA19101 for ; Fri, 5 Oct 2012 14:56:01 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id e10so3893275iej.11 for ; Fri, 05 Oct 2012 07:56:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references :x-provags-id:x-gm-message-state; bh=0q3DeBzUImLGz9rNAhJfav1aUzPvWvgfCRzLTYy81p0=; b=XliZMIhNX1DuhQ7K/K2YIPmIw4rAW8kByTWPCQFWjRDAAp/e5BvXNTEdWi/ym3BNgI T3KkDvD1RBeC3F0wHUkW2AWQCQ/+bzAtA4V6hwH3O85yl4xjDTuv3qeugKORvAINNgoP o98NXMZJDh+zAsIF+Ae2SQS7CLw4q34Blxv3HBtI4AVhCa0g44jpMxKmshsSehjPwPQ+ ith1zqDyyVoZrMmjTN84Xh3BZJjfyRn3c3JQMTbfFP2Z92jxlJZAUKXmvuEOoBdb3bvI 9R78wKB5jFXxF6senFoSKZvVVTxuMcc/+oW0u+QF/g0prIelycvTKkIcwg2vk1bpTlLx i+OA== Received: by 10.50.154.137 with SMTP id vo9mr1395414igb.28.1349448961457; Fri, 05 Oct 2012 07:56:01 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.184.232 with SMTP id ex8csp130614igc; Fri, 5 Oct 2012 07:56:00 -0700 (PDT) Received: by 10.216.24.140 with SMTP id x12mr5816086wex.101.1349448954809; Fri, 05 Oct 2012 07:55:54 -0700 (PDT) Received: from moutng.kundenserver.de (moutng.kundenserver.de. [212.227.17.8]) by mx.google.com with ESMTPS id k79si1911505wej.129.2012.10.05.07.55.48 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 05 Oct 2012 07:55:49 -0700 (PDT) Received-SPF: neutral (google.com: 212.227.17.8 is neither permitted nor denied by best guess record for domain of arnd@arndb.de) client-ip=212.227.17.8; Authentication-Results: mx.google.com; spf=neutral (google.com: 212.227.17.8 is neither permitted nor denied by best guess record for domain of arnd@arndb.de) smtp.mail=arnd@arndb.de 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 Cc: linux-kernel@vger.kernel.org, arm@kernel.org, Arnd Bergmann , Tejun Heo , Li Zefan , Ben Blum 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-Gm-Message-State: ALoCoQnS21YN5klgzUKVl9QZUICRz/V38u6ykd4RtllYG/ZklvjOuXIeoO+Y+g0OZ05XQSYgn5nq 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 --- 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;