2006-05-21 19:03:57

by Ameer Armaly

[permalink] [raw]
Subject: [patch] fs warning fixes

This patch gets rid of two uninitialized variable warnings by initializing idx in fs/bio.c and fd in fs/eventpoll.c; both of these are initialized through pointers later on.

diff --git a/fs/bio.c b/fs/bio.c
index eb8fbc5..c4deed9 100644
--- a/fs/bio.c
+++ b/fs/bio.c
@@ -166,7 +166,7 @@ struct bio *bio_alloc_bioset(gfp_t gfp_m

bio_init(bio);
if (likely(nr_iovecs)) {
- unsigned long idx;
+ unsigned long idx = 0;

bvl = bvec_alloc_bs(gfp_mask, nr_iovecs, &idx, bs);
if (unlikely(!bvl)) {
diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index 1b4491c..243c254 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -497,7 +497,7 @@ void eventpoll_release_file(struct file
*/
asmlinkage long sys_epoll_create(int size)
{
- int error, fd;
+ int error, fd = 0;
struct eventpoll *ep;
struct inode *inode;
struct file *file;


2006-05-21 22:07:42

by Chris Wedgwood

[permalink] [raw]
Subject: Re: [patch] fs warning fixes

On Sun, May 21, 2006 at 03:03:36PM -0400, Ameer Armaly wrote:

> This patch gets rid of two uninitialized variable warnings by
> initializing idx in fs/bio.c and fd in fs/eventpoll.c; both of these
> are initialized through pointers later on.

> - unsigned long idx;
> + unsigned long idx = 0;

[...]

> - int error, fd;
> + int error, fd = 0;

Please don't do this unless it really is fixing a bug. gcc false
warnings are not kernel bugs.