* [PATCH] net: ipv4: fib_semantics: fix uninitialized variable
@ 2019-06-06 14:43 Enrico Weigelt, metux IT consult
2019-06-06 15:47 ` David Ahern
2019-06-09 19:47 ` David Miller
0 siblings, 2 replies; 5+ messages in thread
From: Enrico Weigelt, metux IT consult @ 2019-06-06 14:43 UTC (permalink / raw)
To: linux-kernel; +Cc: davem, kuznet, yoshfuji, netdev
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;
--
1.9.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] net: ipv4: fib_semantics: fix uninitialized variable
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
2019-06-06 21:38 ` Enrico Weigelt, metux IT consult
2019-06-09 19:47 ` David Miller
1 sibling, 2 replies; 5+ messages in thread
From: David Ahern @ 2019-06-06 15:47 UTC (permalink / raw)
To: Enrico Weigelt, metux IT consult, linux-kernel
Cc: davem, kuznet, yoshfuji, netdev
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.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] net: ipv4: fib_semantics: fix uninitialized variable
2019-06-06 15:47 ` David Ahern
@ 2019-06-06 18:35 ` David Miller
2019-06-06 21:38 ` Enrico Weigelt, metux IT consult
1 sibling, 0 replies; 5+ messages in thread
From: David Miller @ 2019-06-06 18:35 UTC (permalink / raw)
To: dsahern; +Cc: info, linux-kernel, kuznet, yoshfuji, netdev
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.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] net: ipv4: fib_semantics: fix uninitialized variable
2019-06-06 15:47 ` David Ahern
2019-06-06 18:35 ` David Miller
@ 2019-06-06 21:38 ` Enrico Weigelt, metux IT consult
1 sibling, 0 replies; 5+ messages in thread
From: Enrico Weigelt, metux IT consult @ 2019-06-06 21:38 UTC (permalink / raw)
To: David Ahern, Enrico Weigelt, metux IT consult, linux-kernel
Cc: davem, kuznet, yoshfuji, netdev
On 06.06.19 17:47, David Ahern wrote:
>
> what compiler version?
>
> if tbl is set, then err is set.
>
gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516
--
Enrico Weigelt, metux IT consult
Free software and Linux embedded engineering
info@metux.net -- +49-151-27565287
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] net: ipv4: fib_semantics: fix uninitialized variable
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-09 19:47 ` David Miller
1 sibling, 0 replies; 5+ messages in thread
From: David Miller @ 2019-06-09 19:47 UTC (permalink / raw)
To: info; +Cc: linux-kernel, kuznet, yoshfuji, netdev
From: "Enrico Weigelt, metux IT consult" <info@metux.net>
Date: Thu, 6 Jun 2019 16:43:17 +0200
> 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>
Applied.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-06-09 19:48 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2019-06-06 21:38 ` Enrico Weigelt, metux IT consult
2019-06-09 19:47 ` David Miller
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.