Re: 2.6.14 assorted warnings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jens Axboe wrote:

On Fri, Oct 28 2005, Arnd Bergmann wrote:
In the example, bvec_alloc_bs does not initialize &idx when nr is not
between 1 and BIO_MAX_PAGES, so gcc is telling the truth here.

Wrong. idx is always initialized if being used.

Is the compiler really that smart as it searches back into the parent-function and try all the combinations? Otherwise, Arnd is correct.
And on an philosophical plane, can/should we put that responsibility onto the compiler? Is it not "easier" to make the functions take care
of its own duties (like the *nix-way) and make the bvec_alloc_bs initialize idx (even if it has to be an error-value)?

I'm thinking something like this. Seems alright?

/Richard

---

diff -Nurp a/fs/bio.c b/fs/bio.c
--- a/fs/bio.c	2005-10-29 06:30:49.000000000 +0200
+++ b/fs/bio.c	2005-10-29 06:33:00.000000000 +0200
@@ -90,6 +90,7 @@ static inline struct bio_vec *bvec_alloc
		case  65 ... 128: *idx = 4; break;
		case 129 ... BIO_MAX_PAGES: *idx = 5; break;
		default:
+			*idx = -1;
			return NULL;
	}
/*

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux