[PATCH 1/1] Staging: android: binder: Fix possible uninitialized variable compile warning

Javier Martinez Canillas javier at dowhile0.org
Thu Apr 19 00:41:51 UTC 2012


On Thu, Apr 19, 2012 at 1:53 AM, Greg Kroah-Hartman
<gregkh at linuxfoundation.org> wrote:
> On Thu, Apr 19, 2012 at 01:17:11AM +0200, Javier Martinez Canillas wrote:
>> GCC warns that buffer_size and buffer variables may be used uninitialized.
>> Set default values to make the compiler happy and get rid of the build noise.
>
> No, gcc is broken here then.  Please fix it instead, as we don't want to
> paper over foolish things like that.
>
> What version of gcc causes this? I don't see this with gcc 4.6.2,
> perhaps you are using too old of a gcc?
>
> greg k-h

Actually I see it with a newer GCC, my version is:

[javier at munra linux]$ gcc --version
gcc (GCC) 4.6.3 20120306 (Red Hat 4.6.3-2)

and this is the compiler output:

[javier at munra linux]$ make M=drivers/staging/android
  CC      drivers/staging/android/binder.o
drivers/staging/android/binder.c: In function ‘binder_alloc_buf’:
drivers/staging/android/binder.c:779:37: warning: ‘buffer_size’ may be
used uninitialized in this function [-Wuninitialized]
drivers/staging/android/binder.c:779:24: warning: ‘buffer’ may be used
uninitialized in this function [-Wuninitialized]
  LD      drivers/staging/android/built-in.o

Best regards,
Javier



More information about the devel mailing list