* [PATCH iproute2] ip, route: fix minor compile warning
@ 2015-12-14 15:34 Daniel Borkmann
2015-12-14 15:51 ` Phil Sutter
0 siblings, 1 reply; 5+ messages in thread
From: Daniel Borkmann @ 2015-12-14 15:34 UTC (permalink / raw)
To: stephen; +Cc: phil, netdev, Daniel Borkmann
Seems like gcc (4.8.3) doesn't catch this false positive, triggering
after 0f7543322c5f ("route: ignore RTAX_HOPLIMIT of value -1"):
iproute.c: In function 'print_route':
iproute.c:301:12: warning: 'val' may be used uninitialized in this function [-Wmaybe-uninitialized]
features &= ~RTAX_FEATURE_ECN;
^
iproute.c:575:10: note: 'val' was declared here
__u32 val;
^
So just shut it up by initializing to 0.
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
---
ip/iproute.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ip/iproute.c b/ip/iproute.c
index c42ea0b..867c8da 100644
--- a/ip/iproute.c
+++ b/ip/iproute.c
@@ -572,7 +572,7 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
mxlock = *(unsigned*)RTA_DATA(mxrta[RTAX_LOCK]);
for (i=2; i<= RTAX_MAX; i++) {
- __u32 val;
+ __u32 val = 0;
if (mxrta[i] == NULL)
continue;
--
1.9.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH iproute2] ip, route: fix minor compile warning
2015-12-14 15:34 [PATCH iproute2] ip, route: fix minor compile warning Daniel Borkmann
@ 2015-12-14 15:51 ` Phil Sutter
2015-12-14 15:53 ` Daniel Borkmann
0 siblings, 1 reply; 5+ messages in thread
From: Phil Sutter @ 2015-12-14 15:51 UTC (permalink / raw)
To: Daniel Borkmann; +Cc: stephen, netdev
On Mon, Dec 14, 2015 at 04:34:29PM +0100, Daniel Borkmann wrote:
> Seems like gcc (4.8.3) doesn't catch this false positive, triggering
> after 0f7543322c5f ("route: ignore RTAX_HOPLIMIT of value -1"):
>
> iproute.c: In function 'print_route':
> iproute.c:301:12: warning: 'val' may be used uninitialized in this function [-Wmaybe-uninitialized]
> features &= ~RTAX_FEATURE_ECN;
> ^
> iproute.c:575:10: note: 'val' was declared here
> __u32 val;
> ^
> So just shut it up by initializing to 0.
Hmm. Interestingly, my patch shouldn't have changed anything relevant
for gcc's decision. OTOH, I don't see a warning using gcc-4.9.3.
Cheers, Phil
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH iproute2] ip, route: fix minor compile warning
2015-12-14 15:51 ` Phil Sutter
@ 2015-12-14 15:53 ` Daniel Borkmann
2015-12-18 1:12 ` Stephen Hemminger
0 siblings, 1 reply; 5+ messages in thread
From: Daniel Borkmann @ 2015-12-14 15:53 UTC (permalink / raw)
To: Phil Sutter, stephen, netdev
On 12/14/2015 04:51 PM, Phil Sutter wrote:
> On Mon, Dec 14, 2015 at 04:34:29PM +0100, Daniel Borkmann wrote:
>> Seems like gcc (4.8.3) doesn't catch this false positive, triggering
>> after 0f7543322c5f ("route: ignore RTAX_HOPLIMIT of value -1"):
>>
>> iproute.c: In function 'print_route':
>> iproute.c:301:12: warning: 'val' may be used uninitialized in this function [-Wmaybe-uninitialized]
>> features &= ~RTAX_FEATURE_ECN;
>> ^
>> iproute.c:575:10: note: 'val' was declared here
>> __u32 val;
>> ^
>> So just shut it up by initializing to 0.
>
> Hmm. Interestingly, my patch shouldn't have changed anything relevant
> for gcc's decision. OTOH, I don't see a warning using gcc-4.9.3.
If I revert it, the warning is gone for me ;) perhaps some heuristic issue
with that gcc version.
Cheers,
Daniel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH iproute2] ip, route: fix minor compile warning
2015-12-14 15:53 ` Daniel Borkmann
@ 2015-12-18 1:12 ` Stephen Hemminger
2015-12-18 9:18 ` Daniel Borkmann
0 siblings, 1 reply; 5+ messages in thread
From: Stephen Hemminger @ 2015-12-18 1:12 UTC (permalink / raw)
To: Daniel Borkmann; +Cc: Phil Sutter, netdev
On Mon, 14 Dec 2015 16:53:20 +0100
Daniel Borkmann <daniel@iogearbox.net> wrote:
> On 12/14/2015 04:51 PM, Phil Sutter wrote:
> > On Mon, Dec 14, 2015 at 04:34:29PM +0100, Daniel Borkmann wrote:
> >> Seems like gcc (4.8.3) doesn't catch this false positive, triggering
> >> after 0f7543322c5f ("route: ignore RTAX_HOPLIMIT of value -1"):
> >>
> >> iproute.c: In function 'print_route':
> >> iproute.c:301:12: warning: 'val' may be used uninitialized in this function [-Wmaybe-uninitialized]
> >> features &= ~RTAX_FEATURE_ECN;
> >> ^
> >> iproute.c:575:10: note: 'val' was declared here
> >> __u32 val;
> >> ^
> >> So just shut it up by initializing to 0.
> >
> > Hmm. Interestingly, my patch shouldn't have changed anything relevant
> > for gcc's decision. OTOH, I don't see a warning using gcc-4.9.3.
>
> If I revert it, the warning is gone for me ;) perhaps some heuristic issue
> with that gcc version.
>
> Cheers,
> Daniel
I don't see this warning on current master with gcc 4.9.2.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH iproute2] ip, route: fix minor compile warning
2015-12-18 1:12 ` Stephen Hemminger
@ 2015-12-18 9:18 ` Daniel Borkmann
0 siblings, 0 replies; 5+ messages in thread
From: Daniel Borkmann @ 2015-12-18 9:18 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: Phil Sutter, netdev
On 12/18/2015 02:12 AM, Stephen Hemminger wrote:
> On Mon, 14 Dec 2015 16:53:20 +0100
> Daniel Borkmann <daniel@iogearbox.net> wrote:
>
>> On 12/14/2015 04:51 PM, Phil Sutter wrote:
>>> On Mon, Dec 14, 2015 at 04:34:29PM +0100, Daniel Borkmann wrote:
>>>> Seems like gcc (4.8.3) doesn't catch this false positive, triggering
>>>> after 0f7543322c5f ("route: ignore RTAX_HOPLIMIT of value -1"):
>>>>
>>>> iproute.c: In function 'print_route':
>>>> iproute.c:301:12: warning: 'val' may be used uninitialized in this function [-Wmaybe-uninitialized]
>>>> features &= ~RTAX_FEATURE_ECN;
>>>> ^
>>>> iproute.c:575:10: note: 'val' was declared here
>>>> __u32 val;
>>>> ^
>>>> So just shut it up by initializing to 0.
>>>
>>> Hmm. Interestingly, my patch shouldn't have changed anything relevant
>>> for gcc's decision. OTOH, I don't see a warning using gcc-4.9.3.
>>
>> If I revert it, the warning is gone for me ;) perhaps some heuristic issue
>> with that gcc version.
>>
>> Cheers,
>> Daniel
>
> I don't see this warning on current master with gcc 4.9.2.
Well, in the commit message I wrote 4.8.3 ... but I don't mind if we drop it, sure.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-12-18 9:18 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-14 15:34 [PATCH iproute2] ip, route: fix minor compile warning Daniel Borkmann
2015-12-14 15:51 ` Phil Sutter
2015-12-14 15:53 ` Daniel Borkmann
2015-12-18 1:12 ` Stephen Hemminger
2015-12-18 9:18 ` Daniel Borkmann
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.