* [KJ] GCC4 cleanup question
@ 2005-05-28 4:00 Chuck Short
2005-05-28 6:25 ` Bongani Hlope
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Chuck Short @ 2005-05-28 4:00 UTC (permalink / raw)
To: kernel-janitors
Hi,
I was wondering how would you fix warnings like the following:
net/ipv4/route.c: In function 'ip_route_input_slow':
net/ipv4/route.c:1770: warning: 'rth' may be used uninitialized in this
functionnet/ipv4/route.c:1797: warning: 'rth' may be used uninitialized
in this functionnet/ipv4/route.c: In function 'ip_route_output_slow':
net/ipv4/route.c:2270: warning: 'rth' may be used uninitialized in this
functionnet/ipv4/route.c:2242: warning: 'rth' may be used uninitialized
in this function
Thanks
chuck
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [KJ] GCC4 cleanup question
2005-05-28 4:00 [KJ] GCC4 cleanup question Chuck Short
@ 2005-05-28 6:25 ` Bongani Hlope
2005-05-29 15:44 ` Ricardo Nabinger Sanchez
2005-05-30 8:33 ` Arnd Bergmann
2 siblings, 0 replies; 4+ messages in thread
From: Bongani Hlope @ 2005-05-28 6:25 UTC (permalink / raw)
To: kernel-janitors
On Saturday 28 May 2005 06:00 am, Chuck Short wrote:
> Hi,
>
> I was wondering how would you fix warnings like the following:
>
> net/ipv4/route.c: In function 'ip_route_input_slow':
> net/ipv4/route.c:1770: warning: 'rth' may be used uninitialized in this
> functionnet/ipv4/route.c:1797: warning: 'rth' may be used uninitialized
> in this functionnet/ipv4/route.c: In function 'ip_route_output_slow':
> net/ipv4/route.c:2270: warning: 'rth' may be used uninitialized in this
> functionnet/ipv4/route.c:2242: warning: 'rth' may be used uninitialized
> in this function
>
> Thanks
> chuck
I don't have GCC4, the first rth is initialised inside the __mkroute_input
function and the second one is initialised in the __mkroute_output function.
I don't know why gcc is giving those warings.
--- net/ipv4/route.c.old 2005-05-18 21:18:19.000000000 +0200
+++ net/ipv4/route.c 2005-05-28 08:23:18.000000000 +0200
@@ -1767,7 +1767,7 @@ static inline int ip_mkroute_input_def(s
struct in_device *in_dev,
u32 daddr, u32 saddr, u32 tos)
{
- struct rtable* rth;
+ struct rtable* rth = NULL;
int err;
unsigned hash;
@@ -2267,7 +2267,7 @@ static inline int ip_mkroute_output(stru
unsigned char hop;
unsigned hash;
int err = -EINVAL;
- struct rtable *rth;
+ struct rtable *rth = NULL;
if (res->fi && res->fi->fib_nhs > 1) {
unsigned char hopcount = res->fi->fib_nhs;
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [KJ] GCC4 cleanup question
2005-05-28 4:00 [KJ] GCC4 cleanup question Chuck Short
2005-05-28 6:25 ` Bongani Hlope
@ 2005-05-29 15:44 ` Ricardo Nabinger Sanchez
2005-05-30 8:33 ` Arnd Bergmann
2 siblings, 0 replies; 4+ messages in thread
From: Ricardo Nabinger Sanchez @ 2005-05-29 15:44 UTC (permalink / raw)
To: kernel-janitors
[-- Attachment #1: Type: text/plain, Size: 685 bytes --]
Quoting Bongani Hlope <bonganilinux@mweb.co.za>
Sent on Sat, 28 May 2005 08:25:54 +0200
> I don't have GCC4, the first rth is initialised inside the
> __mkroute_input function and the second one is initialised in the
> __mkroute_output function. I don't know why gcc is giving those warings.
My guess is because it doesn't know/see that. Wouldn't that be related to
the new interprocedural optimization?
More info, perhaps starting on:
http://gcc.gnu.org/wiki/Interprocedural%20optimizations
--
Ricardo Nabinger Sanchez
GNU/Linux #140696 [http://counter.li.org]
Slackware Linux + FreeBSD
How long a minute is depends on which
side of the bathroom door you're on.
[-- Attachment #2: Type: text/plain, Size: 167 bytes --]
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [KJ] GCC4 cleanup question
2005-05-28 4:00 [KJ] GCC4 cleanup question Chuck Short
2005-05-28 6:25 ` Bongani Hlope
2005-05-29 15:44 ` Ricardo Nabinger Sanchez
@ 2005-05-30 8:33 ` Arnd Bergmann
2 siblings, 0 replies; 4+ messages in thread
From: Arnd Bergmann @ 2005-05-30 8:33 UTC (permalink / raw)
To: kernel-janitors
On Sünnavend 28 Mai 2005 08:25, Bongani Hlope wrote:
> I don't have GCC4, the first rth is initialised inside the __mkroute_input
> function and the second one is initialised in the __mkroute_output function.
> I don't know why gcc is giving those warings.
__mkroute_{in,out}put does not initialize *result if it returns early.
> --- net/ipv4/route.c.old 2005-05-18 21:18:19.000000000 +0200
> +++ net/ipv4/route.c 2005-05-28 08:23:18.000000000 +0200
> @@ -1767,7 +1767,7 @@ static inline int ip_mkroute_input_def(s
> struct in_device *in_dev,
> u32 daddr, u32 saddr, u32 tos)
> {
> - struct rtable* rth;
> + struct rtable* rth = NULL;
> int err;
> unsigned hash;
>
We've already had that discussion. Don't initialize it to a bogus value
in the declaration, but make sure it always gets set in the function
that is responsible for initializing it (__mkroute_input in this case).
Arnd <><
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2005-05-30 8:33 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-28 4:00 [KJ] GCC4 cleanup question Chuck Short
2005-05-28 6:25 ` Bongani Hlope
2005-05-29 15:44 ` Ricardo Nabinger Sanchez
2005-05-30 8:33 ` Arnd Bergmann
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.