* [PATCH] cgroup:cgroup_mount: Fix uninitialized warning
@ 2014-04-19 12:52 Takeshi Misawa
[not found] ` <CABYERD89BtTTJh8j0d0kvCU-xNEy8YJhFaPFr+hjuy5gWQoVNg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: Takeshi Misawa @ 2014-04-19 12:52 UTC (permalink / raw)
To: tj-DgEjT+Ai2ygdnm+yROfE0A, lizefan-hv44wF8Li93QT0dZR+AlfA
Cc: cgroups-u79uwXL29TY76Z2rM5mHXA,
containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA, Takeshi Misawa
This patch fixes the following warning.
kernel/cgroup.c: In function ‘cgroup_mount’:
kernel/cgroup.c:1609:13: warning: ‘root’ may be used uninitialized in this
function
Signed-off-by: Takeshi Misawa <jeantsuru@gmail.com>
---
kernel/cgroup.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 9fcdaa7..ba03421 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -1483,7 +1483,7 @@ static struct dentry *cgroup_mount(struct
file_system_type *fs_type,
int flags, const char *unused_dev_name,
void *data)
{
- struct cgroup_root *root;
+ struct cgroup_root *root = NULL;
struct cgroup_sb_opts opts;
struct dentry *dentry;
int ret;
@@ -1604,6 +1604,11 @@ out_unlock:
if (ret)
return ERR_PTR(ret);
+ if (!root) {
+ if (!ret) ret = -EINVAL;
+ return ERR_PTR(ret);
+ }
+
dentry = kernfs_mount(fs_type, flags, root->kf_root, &new_sb);
if (IS_ERR(dentry) || !new_sb)
cgroup_put(&root->cgrp);
_______________________________________________
Containers mailing list
Containers@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/containers
^ permalink raw reply related [flat|nested] 3+ messages in thread[parent not found: <CABYERD89BtTTJh8j0d0kvCU-xNEy8YJhFaPFr+hjuy5gWQoVNg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: [PATCH] cgroup:cgroup_mount: Fix uninitialized warning [not found] ` <CABYERD89BtTTJh8j0d0kvCU-xNEy8YJhFaPFr+hjuy5gWQoVNg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2014-04-19 12:57 ` Tejun Heo [not found] ` <20140419125706.GA3277-Gd/HAXX7CRxy/B6EtB590w@public.gmane.org> 0 siblings, 1 reply; 3+ messages in thread From: Tejun Heo @ 2014-04-19 12:57 UTC (permalink / raw) To: Takeshi Misawa Cc: cgroups-u79uwXL29TY76Z2rM5mHXA, containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA, linux-kernel-u79uwXL29TY76Z2rM5mHXA On Sat, Apr 19, 2014 at 09:52:14PM +0900, Takeshi Misawa wrote: > This patch fixes the following warning. > > kernel/cgroup.c: In function ‘cgroup_mount’: > kernel/cgroup.c:1609:13: warning: ‘root’ may be used uninitialized in this > function Which compiler are you using? This is a spurious warning which the compiler should be able to avoid pretty easily. Thanks. -- tejun _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/containers ^ permalink raw reply [flat|nested] 3+ messages in thread
[parent not found: <20140419125706.GA3277-Gd/HAXX7CRxy/B6EtB590w@public.gmane.org>]
* Re: [PATCH] cgroup:cgroup_mount: Fix uninitialized warning [not found] ` <20140419125706.GA3277-Gd/HAXX7CRxy/B6EtB590w@public.gmane.org> @ 2014-06-20 15:57 ` Dave Hansen 0 siblings, 0 replies; 3+ messages in thread From: Dave Hansen @ 2014-06-20 15:57 UTC (permalink / raw) To: Tejun Heo Cc: cgroups-u79uwXL29TY76Z2rM5mHXA, containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA, Takeshi Misawa, linux-kernel-u79uwXL29TY76Z2rM5mHXA I'm seeing this too in Linus's current tree (v3.16-rc1-112-g894e552) with: gcc version 4.6.3 20120306 (Red Hat 4.6.3-2) (GCC) On Sat, Apr 19, 2014 at 5:57 AM, Tejun Heo <tj@kernel.org> wrote: > On Sat, Apr 19, 2014 at 09:52:14PM +0900, Takeshi Misawa wrote: > > This patch fixes the following warning. > > > > kernel/cgroup.c: In function ‘cgroup_mount’: > > kernel/cgroup.c:1609:13: warning: ‘root’ may be used uninitialized in > this > > function > > Which compiler are you using? This is a spurious warning which the > compiler should be able to avoid pretty easily. > > Thanks. > > -- > tejun > -- > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.tux.org/lkml/ > -- Dave _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/containers ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-06-20 15:57 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-19 12:52 [PATCH] cgroup:cgroup_mount: Fix uninitialized warning Takeshi Misawa
[not found] ` <CABYERD89BtTTJh8j0d0kvCU-xNEy8YJhFaPFr+hjuy5gWQoVNg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-04-19 12:57 ` Tejun Heo
[not found] ` <20140419125706.GA3277-Gd/HAXX7CRxy/B6EtB590w@public.gmane.org>
2014-06-20 15:57 ` Dave Hansen
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).