* [PATCH iproute2] ip-link: remove warning message
@ 2016-01-21 2:23 Zhang Shengju
2016-02-02 4:56 ` Stephen Hemminger
0 siblings, 1 reply; 2+ messages in thread
From: Zhang Shengju @ 2016-01-21 2:23 UTC (permalink / raw)
To: netdev
the warning was:
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;
^
Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
---
ip/iproute.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ip/iproute.c b/ip/iproute.c
index d5e3ebe..afe70e1 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 = 0U;
if (mxrta[i] == NULL)
continue;
--
1.8.3.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH iproute2] ip-link: remove warning message
2016-01-21 2:23 [PATCH iproute2] ip-link: remove warning message Zhang Shengju
@ 2016-02-02 4:56 ` Stephen Hemminger
0 siblings, 0 replies; 2+ messages in thread
From: Stephen Hemminger @ 2016-02-02 4:56 UTC (permalink / raw)
To: Zhang Shengju; +Cc: netdev
On Thu, 21 Jan 2016 02:23:49 +0000
Zhang Shengju <zhangshengju@cmss.chinamobile.com> wrote:
> the warning was:
> 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;
> ^
>
> Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
> ---
> ip/iproute.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/ip/iproute.c b/ip/iproute.c
> index d5e3ebe..afe70e1 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 = 0U;
>
> if (mxrta[i] == NULL)
> continue;
Your compiler is doing bad dependency analysis.
There is not really a bug here.
It would still be best to initialize to keep broken compilers from causing warning.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-02-02 4:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-21 2:23 [PATCH iproute2] ip-link: remove warning message Zhang Shengju
2016-02-02 4:56 ` Stephen Hemminger
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).