LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] cgroup: Initialize root in cgroup_mount
@ 2015-01-27  0:21 Jason Low
  2015-01-27 16:10 ` Tejun Heo
  0 siblings, 1 reply; 4+ messages in thread
From: Jason Low @ 2015-01-27  0:21 UTC (permalink / raw)
  To: Tejun Heo, Li Zefan; +Cc: linux-kernel, aswin, Jason Low

Compiling kernel/ causes warnings:

    ... ‘root’ may be used uninitialized in this function
    ... ‘root’ was declared here

This isn't an issue since there is already logic to not use
root if we goto out_unlock without setting root.

Explicitly initialize root to NULL to suppress this so that we can
focus on catching warnings that can potentially cause bigger issues.

Signed-off-by: Jason Low <jason.low2@hp.com>
---
 kernel/cgroup.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index bb263d0..66684f3 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -1738,8 +1738,8 @@ static struct dentry *cgroup_mount(struct file_system_type *fs_type,
 			 void *data)
 {
 	struct super_block *pinned_sb = NULL;
+	struct cgroup_root *root = NULL;
 	struct cgroup_subsys *ss;
-	struct cgroup_root *root;
 	struct cgroup_sb_opts opts;
 	struct dentry *dentry;
 	int ret;
-- 
1.7.1




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] cgroup: Initialize root in cgroup_mount
  2015-01-27  0:21 [PATCH] cgroup: Initialize root in cgroup_mount Jason Low
@ 2015-01-27 16:10 ` Tejun Heo
  2015-01-27 17:46   ` Jason Low
  0 siblings, 1 reply; 4+ messages in thread
From: Tejun Heo @ 2015-01-27 16:10 UTC (permalink / raw)
  To: Jason Low; +Cc: Li Zefan, linux-kernel, aswin

On Mon, Jan 26, 2015 at 04:21:39PM -0800, Jason Low wrote:
> Compiling kernel/ causes warnings:
> 
>     ... ‘root’ may be used uninitialized in this function
>     ... ‘root’ was declared here
> 
> This isn't an issue since there is already logic to not use
> root if we goto out_unlock without setting root.
> 
> Explicitly initialize root to NULL to suppress this so that we can
> focus on catching warnings that can potentially cause bigger issues.

Which complier are you using?  The variable, AFAICS, is always set
before being deref'd and the function hasn't triggered spurious
warnings for quite a while with differing versions of gcc.

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] cgroup: Initialize root in cgroup_mount
  2015-01-27 16:10 ` Tejun Heo
@ 2015-01-27 17:46   ` Jason Low
  2015-01-27 18:18     ` Tejun Heo
  0 siblings, 1 reply; 4+ messages in thread
From: Jason Low @ 2015-01-27 17:46 UTC (permalink / raw)
  To: Tejun Heo; +Cc: Li Zefan, linux-kernel, aswin, jason.low2

On Tue, 2015-01-27 at 11:10 -0500, Tejun Heo wrote:
> On Mon, Jan 26, 2015 at 04:21:39PM -0800, Jason Low wrote:
> > Compiling kernel/ causes warnings:
> > 
> >     ... ‘root’ may be used uninitialized in this function
> >     ... ‘root’ was declared here
> > 
> > This isn't an issue since there is already logic to not use
> > root if we goto out_unlock without setting root.
> > 
> > Explicitly initialize root to NULL to suppress this so that we can
> > focus on catching warnings that can potentially cause bigger issues.
> 
> Which complier are you using?

Hi Tejun, one of the versions I am seeing this on is gcc 4.6.3.

>   The variable, AFAICS, is always set
> before being deref'd and the function hasn't triggered spurious
> warnings for quite a while with differing versions of gcc.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] cgroup: Initialize root in cgroup_mount
  2015-01-27 17:46   ` Jason Low
@ 2015-01-27 18:18     ` Tejun Heo
  0 siblings, 0 replies; 4+ messages in thread
From: Tejun Heo @ 2015-01-27 18:18 UTC (permalink / raw)
  To: Jason Low; +Cc: Li Zefan, linux-kernel, aswin

On Tue, Jan 27, 2015 at 09:46:36AM -0800, Jason Low wrote:
> On Tue, 2015-01-27 at 11:10 -0500, Tejun Heo wrote:
> > On Mon, Jan 26, 2015 at 04:21:39PM -0800, Jason Low wrote:
> > > Compiling kernel/ causes warnings:
> > > 
> > >     ... ‘root’ may be used uninitialized in this function
> > >     ... ‘root’ was declared here
> > > 
> > > This isn't an issue since there is already logic to not use
> > > root if we goto out_unlock without setting root.
> > > 
> > > Explicitly initialize root to NULL to suppress this so that we can
> > > focus on catching warnings that can potentially cause bigger issues.
> > 
> > Which complier are you using?
> 
> Hi Tejun, one of the versions I am seeing this on is gcc 4.6.3.

Can you plesae try something newer?  gcc for a while had trouble with
these spurious warnings.  4.6.2 is 3+ years old now.

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-01-27 18:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-27  0:21 [PATCH] cgroup: Initialize root in cgroup_mount Jason Low
2015-01-27 16:10 ` Tejun Heo
2015-01-27 17:46   ` Jason Low
2015-01-27 18:18     ` Tejun Heo

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).