* net/ipv4/inetpeer.c stack warnings
@ 2007-07-19 12:29 Gabriel C
2007-07-19 12:48 ` Patrick McHardy
2007-07-19 21:16 ` David Miller
0 siblings, 2 replies; 5+ messages in thread
From: Gabriel C @ 2007-07-19 12:29 UTC (permalink / raw)
To: Linux Kernel Mailing List; +Cc: netdev
Hello ,
I noticed on current git this warning in net/ipv4/inetpeer.c
...
CC net/ipv4/inetpeer.o
net/ipv4/inetpeer.c: In function 'unlink_from_pool':
net/ipv4/inetpeer.c:297: warning: the address of 'stack' will always
evaluate as 'true'
net/ipv4/inetpeer.c:297: warning: the address of 'stack' will always
evaluate as 'true'
net/ipv4/inetpeer.c: In function 'inet_getpeer':
net/ipv4/inetpeer.c:409: warning: the address of 'stack' will always
evaluate as 'true'
net/ipv4/inetpeer.c:409: warning: the address of 'stack' will always
evaluate as 'true'
...
Regards,
Gabriel C
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: net/ipv4/inetpeer.c stack warnings
2007-07-19 12:29 net/ipv4/inetpeer.c stack warnings Gabriel C
@ 2007-07-19 12:48 ` Patrick McHardy
2007-07-19 13:10 ` Gabriel C
2007-07-21 2:39 ` David Miller
2007-07-19 21:16 ` David Miller
1 sibling, 2 replies; 5+ messages in thread
From: Patrick McHardy @ 2007-07-19 12:48 UTC (permalink / raw)
To: Gabriel C; +Cc: Linux Kernel Mailing List, netdev
[-- Attachment #1: Type: text/plain, Size: 265 bytes --]
Gabriel C wrote:
> Hello ,
>
> I noticed on current git this warning in net/ipv4/inetpeer.c
Yeah, I have no idea why the gcc people thought that this was
something worth warning about. Especially since explicitly
checking for != NULL silences the warning again.
[-- Attachment #2: x --]
[-- Type: text/plain, Size: 1267 bytes --]
[IPV4]: Fix inetpeer gcc-4.2 warnings
CC net/ipv4/inetpeer.o
net/ipv4/inetpeer.c: In function 'unlink_from_pool':
net/ipv4/inetpeer.c:297: warning: the address of 'stack' will always evaluate as 'true'
net/ipv4/inetpeer.c:297: warning: the address of 'stack' will always evaluate as 'true'
net/ipv4/inetpeer.c: In function 'inet_getpeer':
net/ipv4/inetpeer.c:409: warning: the address of 'stack' will always evaluate as 'true'
net/ipv4/inetpeer.c:409: warning: the address of 'stack' will always evaluate as 'true'
"Fix" by checking for != NULL.
Signed-off-by: Patrick McHardy <kaber@trash.net>
diff --git a/net/ipv4/inetpeer.c b/net/ipv4/inetpeer.c
index 2f44e61..f725f9f 100644
--- a/net/ipv4/inetpeer.c
+++ b/net/ipv4/inetpeer.c
@@ -158,7 +158,7 @@ static void unlink_from_unused(struct inet_peer *p)
#define lookup(_daddr,_stack) \
({ \
struct inet_peer *u, **v; \
- if (_stack) { \
+ if (_stack != NULL) { \
stackptr = _stack; \
*stackptr++ = &peer_root; \
} \
@@ -169,7 +169,7 @@ static void unlink_from_unused(struct inet_peer *p)
v = &u->avl_left; \
else \
v = &u->avl_right; \
- if (_stack) \
+ if (_stack != NULL) \
*stackptr++ = v; \
u = *v; \
} \
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: net/ipv4/inetpeer.c stack warnings
2007-07-19 12:48 ` Patrick McHardy
@ 2007-07-19 13:10 ` Gabriel C
2007-07-21 2:39 ` David Miller
1 sibling, 0 replies; 5+ messages in thread
From: Gabriel C @ 2007-07-19 13:10 UTC (permalink / raw)
To: Patrick McHardy; +Cc: Linux Kernel Mailing List, netdev
Patrick McHardy wrote:
> Gabriel C wrote:
>
>> Hello ,
>>
>> I noticed on current git this warning in net/ipv4/inetpeer.c
>>
>
> Yeah, I have no idea why the gcc people thought that this was
> something worth warning about. Especially since explicitly
> checking for != NULL silences the warning again.
>
>
>
Thx , the patch fixes that for me.
Gabriel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: net/ipv4/inetpeer.c stack warnings
2007-07-19 12:29 net/ipv4/inetpeer.c stack warnings Gabriel C
2007-07-19 12:48 ` Patrick McHardy
@ 2007-07-19 21:16 ` David Miller
1 sibling, 0 replies; 5+ messages in thread
From: David Miller @ 2007-07-19 21:16 UTC (permalink / raw)
To: nix.or.die; +Cc: linux-kernel, netdev
From: Gabriel C <nix.or.die@googlemail.com>
Date: Thu, 19 Jul 2007 14:29:53 +0200
> Hello ,
>
> I noticed on current git this warning in net/ipv4/inetpeer.c
>
> ...
>
> CC net/ipv4/inetpeer.o
> net/ipv4/inetpeer.c: In function 'unlink_from_pool':
> net/ipv4/inetpeer.c:297: warning: the address of 'stack' will always
> evaluate as 'true'
> net/ipv4/inetpeer.c:297: warning: the address of 'stack' will always
> evaluate as 'true'
> net/ipv4/inetpeer.c: In function 'inet_getpeer':
> net/ipv4/inetpeer.c:409: warning: the address of 'stack' will always
> evaluate as 'true'
> net/ipv4/inetpeer.c:409: warning: the address of 'stack' will always
> evaluate as 'true'
The compiler should not warn about that at all, the lookup()
macro is called with "stack" set to NULL.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: net/ipv4/inetpeer.c stack warnings
2007-07-19 12:48 ` Patrick McHardy
2007-07-19 13:10 ` Gabriel C
@ 2007-07-21 2:39 ` David Miller
1 sibling, 0 replies; 5+ messages in thread
From: David Miller @ 2007-07-21 2:39 UTC (permalink / raw)
To: kaber; +Cc: nix.or.die, linux-kernel, netdev
From: Patrick McHardy <kaber@trash.net>
Date: Thu, 19 Jul 2007 14:48:59 +0200
> Gabriel C wrote:
> > Hello ,
> >
> > I noticed on current git this warning in net/ipv4/inetpeer.c
>
> Yeah, I have no idea why the gcc people thought that this was
> something worth warning about. Especially since explicitly
> checking for != NULL silences the warning again.
Sigh, applied :-)
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2007-07-21 2:39 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-19 12:29 net/ipv4/inetpeer.c stack warnings Gabriel C
2007-07-19 12:48 ` Patrick McHardy
2007-07-19 13:10 ` Gabriel C
2007-07-21 2:39 ` David Miller
2007-07-19 21:16 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).