From: Ross Zwisler <ross.zwisler@linux.intel.com>
To: Linus Torvalds <torvalds@linux-foundation.org>,
Tejun Heo <tj@kernel.org>
Cc: Ross Zwisler <ross.zwisler@linux.intel.com>,
Li Zefan <lizefan@huawei.com>,
Daniel Wagner <daniel.wagner@bmw-carit.de>,
Johannes Weiner <hannes@cmpxchg.org>,
cgroups@vger.kernel.org, linux-kernel@vger.kernel.org,
Dave Jones <davej@codemonkey.org.uk>,
kernel-team@fb.com, Aleksa Sarai <cyphar@cyphar.com>,
Michal Hocko <mhocko@kernel.org>, Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Neil Horman <nhorman@tuxdriver.com>
Subject: [PATCH] cgroup: Fix uninitialized variable warning
Date: Wed, 23 Dec 2015 14:53:27 -0700 [thread overview]
Message-ID: <1450907607-5060-1-git-send-email-ross.zwisler@linux.intel.com> (raw)
Commit 1f7dd3e5a6e4 ("cgroup: fix handling of multi-destination migration
from subtree_control enabling") introduced the following compiler warning:
mm/memcontrol.c: In function ‘mem_cgroup_can_attach’:
mm/memcontrol.c:4790:9: warning: ‘memcg’ may be used uninitialized in this function [-Wmaybe-uninitialized]
mc.to = memcg;
^
Fix this by initializing 'memcg' to NULL.
This was found using gcc (GCC) 4.9.2 20150212 (Red Hat 4.9.2-6).
Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
---
mm/memcontrol.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 48b22c3..ffd9750 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -4735,7 +4735,7 @@ static void mem_cgroup_clear_mc(void)
static int mem_cgroup_can_attach(struct cgroup_taskset *tset)
{
struct cgroup_subsys_state *css;
- struct mem_cgroup *memcg;
+ struct mem_cgroup *memcg = NULL; /* unneeded init to make gcc happy */
struct mem_cgroup *from;
struct task_struct *leader, *p;
struct mm_struct *mm;
--
2.6.3
next reply other threads:[~2015-12-23 21:54 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-23 21:53 Ross Zwisler [this message]
2015-12-28 15:45 ` Tejun Heo
-- strict thread matches above, loose matches on Subject: below --
2015-12-23 21:30 Ross Zwisler
2015-12-23 21:35 ` Tejun Heo
2015-12-23 21:38 ` Ross Zwisler
2015-12-23 21:41 ` 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=1450907607-5060-1-git-send-email-ross.zwisler@linux.intel.com \
--to=ross.zwisler@linux.intel.com \
--cc=cgroups@vger.kernel.org \
--cc=cyphar@cyphar.com \
--cc=daniel.wagner@bmw-carit.de \
--cc=davej@codemonkey.org.uk \
--cc=hannes@cmpxchg.org \
--cc=kernel-team@fb.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lizefan@huawei.com \
--cc=mhocko@kernel.org \
--cc=mingo@redhat.com \
--cc=nhorman@tuxdriver.com \
--cc=peterz@infradead.org \
--cc=tj@kernel.org \
--cc=torvalds@linux-foundation.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
Powered by JetHome