mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] fuse: mark variables uninitialized
@ 2012-08-28  8:38 Daniel Mack
  2012-08-28 10:26 ` Miklos Szeredi
  0 siblings, 1 reply; 2+ messages in thread
From: Daniel Mack @ 2012-08-28  8:38 UTC (permalink / raw)
  To: linux-kernel; +Cc: Daniel Mack, Brian Foster, Miklos Szeredi

gcc 4.6.3 complains about uninitialized variables in fs/fuse/control.c:

  CC      fs/fuse/control.o
fs/fuse/control.c: In function ‘fuse_conn_congestion_threshold_write’:
fs/fuse/control.c:165:29: warning: ‘val’ may be used uninitialized in this function [-Wuninitialized]
fs/fuse/control.c: In function ‘fuse_conn_max_background_write’:
fs/fuse/control.c:128:23: warning: ‘val’ may be used uninitialized in this function [-Wuninitialized]

fuse_conn_limit_write() will always return non-zero unless the &val
is modified, so the warning is misleading. Let the compiler know
about it by marking 'val' with 'uninitialized_var'.

Signed-off-by: Daniel Mack <zonque@gmail.com>
Cc: Brian Foster <bfoster@redhat.com>
Cc: Miklos Szeredi <mszeredi@suse.cz>
---
 fs/fuse/control.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/fuse/control.c b/fs/fuse/control.c
index 03ff5b1..75a20c0 100644
--- a/fs/fuse/control.c
+++ b/fs/fuse/control.c
@@ -117,7 +117,7 @@ static ssize_t fuse_conn_max_background_write(struct file *file,
 					      const char __user *buf,
 					      size_t count, loff_t *ppos)
 {
-	unsigned val;
+	unsigned uninitialized_var(val);
 	ssize_t ret;
 
 	ret = fuse_conn_limit_write(file, buf, count, ppos, &val,
@@ -154,7 +154,7 @@ static ssize_t fuse_conn_congestion_threshold_write(struct file *file,
 						    const char __user *buf,
 						    size_t count, loff_t *ppos)
 {
-	unsigned val;
+	unsigned uninitialized_var(val);
 	ssize_t ret;
 
 	ret = fuse_conn_limit_write(file, buf, count, ppos, &val,
-- 
1.7.11.4


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

* Re: [PATCH] fuse: mark variables uninitialized
  2012-08-28  8:38 [PATCH] fuse: mark variables uninitialized Daniel Mack
@ 2012-08-28 10:26 ` Miklos Szeredi
  0 siblings, 0 replies; 2+ messages in thread
From: Miklos Szeredi @ 2012-08-28 10:26 UTC (permalink / raw)
  To: Daniel Mack; +Cc: linux-kernel, Brian Foster

On Tue, 2012-08-28 at 10:38 +0200, Daniel Mack wrote:
> gcc 4.6.3 complains about uninitialized variables in fs/fuse/control.c:
> 
>   CC      fs/fuse/control.o
> fs/fuse/control.c: In function ‘fuse_conn_congestion_threshold_write’:
> fs/fuse/control.c:165:29: warning: ‘val’ may be used uninitialized in this function [-Wuninitialized]
> fs/fuse/control.c: In function ‘fuse_conn_max_background_write’:
> fs/fuse/control.c:128:23: warning: ‘val’ may be used uninitialized in this function [-Wuninitialized]
> 
> fuse_conn_limit_write() will always return non-zero unless the &val
> is modified, so the warning is misleading. Let the compiler know
> about it by marking 'val' with 'uninitialized_var'.

Thanks, applied.

Miklos



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

end of thread, other threads:[~2012-08-28 13:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-28  8:38 [PATCH] fuse: mark variables uninitialized Daniel Mack
2012-08-28 10:26 ` Miklos Szeredi

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