lkml.org 
[lkml]   [2019]   [Jun]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] net: ipv4: fib_semantics: fix uninitialized variable
From
Date
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.

\
 
 \ /
  Last update: 2019-06-06 17:48    [W:0.085 / U:13.640 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site