linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fib_semantics: Fix warning in fib_check_nh_v4_gw
@ 2019-06-17 10:21 Vincenzo Frascino
  2019-06-17 17:12 ` David Ahern
  0 siblings, 1 reply; 2+ messages in thread
From: Vincenzo Frascino @ 2019-06-17 10:21 UTC (permalink / raw)
  To: linux-kernel, netdev; +Cc: davem, kuznet, yoshfuji, vincenzo.frascino

Currently, the err variable in fib_check_nh_v4_gw may be used
uninitialized leading to the warning below:

  fib_semantics.c: In function ‘fib_check_nh_v4_gw’:
  fib_semantics.c:1023:12: warning: ‘err’ may be used
    uninitialised in this function [-Wmaybe-uninitialized]
       if (!tbl || err) {
                   ^~

Initialize err to 0 to fix the warning.

Cc: "David S. Miller" <davem@davemloft.net>
Cc: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
Cc: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
---
 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 b80410673915..bfa49a88d03a 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;
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] fib_semantics: Fix warning in fib_check_nh_v4_gw
  2019-06-17 10:21 [PATCH] fib_semantics: Fix warning in fib_check_nh_v4_gw Vincenzo Frascino
@ 2019-06-17 17:12 ` David Ahern
  0 siblings, 0 replies; 2+ messages in thread
From: David Ahern @ 2019-06-17 17:12 UTC (permalink / raw)
  To: Vincenzo Frascino, linux-kernel, netdev; +Cc: davem, kuznet, yoshfuji

On 6/17/19 4:21 AM, Vincenzo Frascino wrote:
> Currently, the err variable in fib_check_nh_v4_gw may be used
> uninitialized leading to the warning below:
> 
>   fib_semantics.c: In function ‘fib_check_nh_v4_gw’:
>   fib_semantics.c:1023:12: warning: ‘err’ may be used
>     uninitialised in this function [-Wmaybe-uninitialized]
>        if (!tbl || err) {
>                    ^~
> 
> Initialize err to 0 to fix the warning.
> 
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
> Cc: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
> Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
> ---
>  net/ipv4/fib_semantics.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 

already fixed in net; will make it to net-next on next merge.



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-06-17 17:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-17 10:21 [PATCH] fib_semantics: Fix warning in fib_check_nh_v4_gw Vincenzo Frascino
2019-06-17 17:12 ` David Ahern

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).