linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Aleksa Sarai <cyphar@cyphar.com>
To: tj@kernel.org, lizefan@huawei.com, mingo@redhat.com,
	peterz@infradead.org
Cc: richard@nod.at, fweisbec@gmail.com, linux-kernel@vger.kernel.org,
	cgroups@vger.kernel.org, Aleksa Sarai <cyphar@cyphar.com>
Subject: [PATCH v14 1/4] cgroup: fix uninitialised iterator in for_each_subsys_which
Date: Tue,  9 Jun 2015 21:32:07 +1000	[thread overview]
Message-ID: <1433849530-22845-2-git-send-email-cyphar@cyphar.com> (raw)
In-Reply-To: <1433849530-22845-1-git-send-email-cyphar@cyphar.com>

Fix the fact that @ssid is uninitialised in the case where
CGROUP_SUBSYS_COUNT = 0 by setting ssid to 0.

Fixes: cb4a31675270 ("cgroup: use bitmask to filter for_each_subsys")
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
---
 kernel/cgroup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 6d6d3c7..12b580f 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -424,7 +424,7 @@ static int notify_on_release(const struct cgroup *cgrp)
  */
 #define for_each_subsys_which(ss, ssid, ss_maskp)			\
 	if (!CGROUP_SUBSYS_COUNT) /* to avoid spurious gcc warning */	\
-		;							\
+		(ssid) = 0;						\
 	else								\
 		for_each_set_bit(ssid, ss_maskp, CGROUP_SUBSYS_COUNT)	\
 			if (((ss) = cgroup_subsys[ssid]) && false)	\
-- 
2.4.2


  reply	other threads:[~2015-06-09 11:33 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-09 11:32 [PATCH v14 0/4] cgroup: add PIDs subsystem Aleksa Sarai
2015-06-09 11:32 ` Aleksa Sarai [this message]
2015-06-10  4:49   ` [PATCH v14 1/4] cgroup: fix uninitialised iterator in for_each_subsys_which Tejun Heo
2015-06-09 11:32 ` [PATCH v14 2/4] cgroup, block: implement task_get_css() Aleksa Sarai
2015-06-09 11:32 ` [PATCH v14 3/4] cgroup: allow a cgroup subsystem to reject a fork Aleksa Sarai
2015-06-09 11:32 ` [PATCH v14 4/4] cgroup: implement the PIDs subsystem Aleksa Sarai
2015-06-10  4:53   ` Tejun Heo
2015-06-10 15:01     ` Aleksa Sarai
2015-06-12 17:21       ` [PATCH] cgroup: add documentation for the PIDs controller Aleksa Sarai
2015-07-14 21:32         ` Tejun Heo
2015-07-14 21:31     ` [PATCH v14 4/4] cgroup: implement the PIDs subsystem Tejun Heo

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=1433849530-22845-2-git-send-email-cyphar@cyphar.com \
    --to=cyphar@cyphar.com \
    --cc=cgroups@vger.kernel.org \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizefan@huawei.com \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=richard@nod.at \
    --cc=tj@kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).