On Mon, May 31, 2010 at 12:19:54AM +0100, Ralf Baechle wrote:
> > > Note: I tried to test a little with bigsur_defconfig
> > > but get_user() is buggy. Or at least my gcc thinks that
> > > first argument may be used uninitialized.
> > > I think mips needs to fix the 64 bit variant of get_user().
> > > I took a quick look but ran away.
> > My gcc:
> > mips-linux-gcc (GCC) 4.1.2
> > Copyright (C) 2006 Free Software Foundation, Inc.
I played with it for a bit. The warning is present in all gcc 4.1.0 to
4.1.2 and it is bogus. When I first looked into this years ago I just
gave up on gcc 4.1 as a newer version was already available.
The variable returned by get_user is undefined in case of an error, so
what get_user() is doing is entirely legitimate. This is different from
copy_from_user() which in case of an error will clear the remainder of
the destination area which couldn't not be copied from userspace.
A test compile of a bigsur_defconfig without and with your patch shows
a size increase of only 80 bytes with gcc 4.5.0. So I'm considering
your patch for inclusion but I want to play with alternatives for a bit.
Outlining may the right thing with modern compilers.