All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: dsahern@gmail.com
Cc: info@metux.net, linux-kernel@vger.kernel.org,
	kuznet@ms2.inr.ac.ru, yoshfuji@linux-ipv6.org,
	netdev@vger.kernel.org
Subject: Re: [PATCH] net: ipv4: fib_semantics: fix uninitialized variable
Date: Thu, 06 Jun 2019 11:35:47 -0700 (PDT)	[thread overview]
Message-ID: <20190606.113547.1877303546486591185.davem@davemloft.net> (raw)
In-Reply-To: <0ba84175-49be-9023-271d-516c93e2d83e@gmail.com>

From: David Ahern <dsahern@gmail.com>
Date: Thu, 6 Jun 2019 09:47:34 -0600

> On 6/6/19 8:43 AM, Enrico Weigelt, metux IT consult wrote:
>> From: Enrico Weigelt <info@metux.net>
>> 
>> fix an uninitialized variable:
>> 
>>   CC      net/ipv4/fib_semantics.o
>> net/ipv4/fib_semantics.c: In function 'fib_check_nh_v4_gw':
>> net/ipv4/fib_semantics.c:1027:12: warning: 'err' may be used uninitialized in this function [-Wmaybe-uninitialized]
>>    if (!tbl || err) {
>>             ^~
>> 
>> Signed-off-by: Enrico Weigelt <info@metux.net>
>> ---
>>  net/ipv4/fib_semantics.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
>> index b804106..bfa49a8 100644
>> --- a/net/ipv4/fib_semantics.c
>> +++ b/net/ipv4/fib_semantics.c
>> @@ -964,7 +964,7 @@ static int fib_check_nh_v4_gw(struct net *net, struct fib_nh *nh, u32 table,
>>  {
>>  	struct net_device *dev;
>>  	struct fib_result res;
>> -	int err;
>> +	int err = 0;
>>  
>>  	if (nh->fib_nh_flags & RTNH_F_ONLINK) {
>>  		unsigned int addr_type;
>> 
> 
> what compiler version?
> 
> if tbl is set, then err is set.

It's unfortunate that it can't walk through that simple logic and set
of dependencies but we'll have to quiet this warning whether we like it
or not.

  reply	other threads:[~2019-06-06 18:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-06 14:43 [PATCH] net: ipv4: fib_semantics: fix uninitialized variable Enrico Weigelt, metux IT consult
2019-06-06 15:47 ` David Ahern
2019-06-06 18:35   ` David Miller [this message]
2019-06-06 21:38   ` Enrico Weigelt, metux IT consult
2019-06-09 19:47 ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190606.113547.1877303546486591185.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=dsahern@gmail.com \
    --cc=info@metux.net \
    --cc=kuznet@ms2.inr.ac.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=yoshfuji@linux-ipv6.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.