Skip to contentSkip to conversation

autofs4 - fix false positive compile error

PATCH In review Ian Kent 2 participants 3 messages Jun 25, 2014 – Jun 26, 2014

Subsystems (2)
lore
Share & tools
lore

Ian Kent

author maintainer
#0 lore raw

PATCH 1/1 autofs4 - fix false positive compile error

On strict build environments we can see:

fs/autofs4/inode.c: In function 'autofs4_fill_super':
fs/autofs4/inode.c:312: error: 'pgrp' may be used uninitialized in this function
make[2]: *** [fs/autofs4/inode.o] Error 1
make[1]: *** [fs/autofs4] Error 2
make: *** [fs] Error 2
make: *** Waiting for unfinished jobs....

This is due to the use of pgrp_set being used to indicate pgrp has has been set rather than initializing pgrp itself.

---
 fs/autofs4/inode.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/autofs4/inode.c +1 -1
index d7bd395..1c55388 100644
@@ -210,7 +210,7 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent)
 	int pipefd;
 	struct autofs_sb_info *sbi;
 	struct autofs_info *ino;
-	int pgrp;
+	int pgrp = 0;
 	bool pgrp_set = false;
 	int ret = -EINVAL;
 
#1 lore raw
Quoted 10 lines · On Wed, 25 Jun 2014 20:49:39 +0800 Ian Kent <[email protected]> wrote:

On strict build environments we can see:

fs/autofs4/inode.c: In function 'autofs4_fill_super':
fs/autofs4/inode.c:312: error: 'pgrp' may be used uninitialized in this function
make[2]: *** [fs/autofs4/inode.o] Error 1
make[1]: *** [fs/autofs4] Error 2
make: *** [fs] Error 2
make: *** Waiting for unfinished jobs....

Quoted 3 lines

This is due to the use of pgrp_set being used to indicate pgrp has has been set rather than initializing pgrp itself.

Yes, that code seems to be explicitly designed to trigger a gcc warning ;)

What is a "strict build environment"? Someone's using -Werror for the entire kernel? That must make for a miserable life.

author maintainer
#2 lore raw
Quoted 12 lines · Andrew Morton
Quoted 10 lines · On Wed, 25 Jun 2014 20:49:39 +0800 Ian Kent <[email protected]> wrote:

On strict build environments we can see:

fs/autofs4/inode.c: In function 'autofs4_fill_super':
fs/autofs4/inode.c:312: error: 'pgrp' may be used uninitialized in this function
make[2]: *** [fs/autofs4/inode.o] Error 1
make[1]: *** [fs/autofs4] Error 2
make: *** [fs] Error 2
make: *** Waiting for unfinished jobs....

Quoted 8 lines
Quoted 3 lines

This is due to the use of pgrp_set being used to indicate pgrp has has been set rather than initializing pgrp itself.

Yes, that code seems to be explicitly designed to trigger a gcc warning ;)

What is a "strict build environment"? Someone's using -Werror for the entire kernel? That must make for a miserable life.

Yes, TBH I was a bit surprised myself.
It resulted from a RHEL-6.6 patch submission.

I didn't notice it and ended up missing an internal (RedHat) patch submission deadline as my original interest in these was the result of an upstream discussion and I stupidly relied on my upstream testing.

It might just be that our internal up and coming file system tree is specifically more fussy but never the less I got caught out.

Ian