Re: [PATCH] eliminate compiler warning for xpc_channel.c

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

 



On Tue, Apr 04, 2006 at 07:34:08AM -0700, Luck, Tony wrote:
> >> Did you mean to say "*msg = NULL"?
> >
> > this is actually an ANSI-permitted idiom for shutting up compiler
> > warnings while not actually initialising the variable.
> 
> So I learned something new today!
> 
> But then this patch is wrong ... it shuts the compiler up
> and leaves 4 ways that xpc_allocate_msg() can return without doing
> the initialization, so that msg will be used uninitialized.

You are correct: "*msg = NULL" is the right answer.

The compiler being used is: "gcc (GCC) 4.1.0 (SUSE Linux)".

In the past when I've seen complier warnings of this nature, it usually
(but not always) turned out that the compiler was unable to 'see' that
things were really okay. In this particular case, I hadn't seen this
warning until just yesterday (my build machine was just updated a few
days ago), and since nothing in this area of the code had changed for
some time now, I just assumed that the compiler was not seeing things
properly. It didn't occur to me that xpc_allocate_msg() was possibly
being inlined and thus the compiler was giving a correct warning that
should not be ignored.

Do you want a new patch, or are you comfortable with switching the
'msg' to a 'NULL'?

Thanks for looking more closely than I obviously did.

Dean

-
: send the line "unsubscribe linux-ia64" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel]     [Sparc Linux]     [DCCP]     [Linux ARM]     [Yosemite News]     [Linux SCSI]     [Linux x86_64]     [Linux for Ham Radio]

  Powered by Linux