[iproute2] tc: fix warning in tc/m_ct.c
diff mbox series

Message ID 20191127051934.158900-1-brianvv@google.com
State Accepted
Delegated to: stephen hemminger
Headers show
Series
  • [iproute2] tc: fix warning in tc/m_ct.c
Related show

Commit Message

Brian Vazquez Nov. 27, 2019, 5:19 a.m. UTC
Warning was:
m_ct.c:370:13: warning: variable 'nat' is used uninitialized whenever
'if' condition is false

Cc: Paul Blakey <paulb@mellanox.com>
Fixes: c8a494314c40 ("tc: Introduce tc ct action")
Signed-off-by: Brian Vazquez <brianvv@google.com>
---
 tc/m_ct.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Paul Blakey Nov. 27, 2019, 7:47 a.m. UTC | #1
On 11/27/2019 7:19 AM, Brian Vazquez wrote:

> Warning was:
> m_ct.c:370:13: warning: variable 'nat' is used uninitialized whenever
> 'if' condition is false
>
> Cc: Paul Blakey <paulb@mellanox.com>
> Fixes: c8a494314c40 ("tc: Introduce tc ct action")
> Signed-off-by: Brian Vazquez <brianvv@google.com>
> ---
>   tc/m_ct.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tc/m_ct.c b/tc/m_ct.c
> index 8df2f610..45fa4a8c 100644
> --- a/tc/m_ct.c
> +++ b/tc/m_ct.c
> @@ -359,7 +359,7 @@ static void ct_print_nat(int ct_action, struct rtattr **tb)
>   {
>   	size_t done = 0;
>   	char out[256] = "";
> -	bool nat;
> +	bool nat = false;
>   
>   	if (!(ct_action & TCA_CT_ACT_NAT))
>   		return;

Yes nat should be false here.

Looks good to me.

Thanks.
Stephen Hemminger Dec. 4, 2019, 7:37 p.m. UTC | #2
On Tue, 26 Nov 2019 21:19:34 -0800
Brian Vazquez <brianvv@google.com> wrote:

> Warning was:
> m_ct.c:370:13: warning: variable 'nat' is used uninitialized whenever
> 'if' condition is false
> 
> Cc: Paul Blakey <paulb@mellanox.com>
> Fixes: c8a494314c40 ("tc: Introduce tc ct action")
> Signed-off-by: Brian Vazquez <brianvv@google.com>
> ---

Applied

Patch
diff mbox series

diff --git a/tc/m_ct.c b/tc/m_ct.c
index 8df2f610..45fa4a8c 100644
--- a/tc/m_ct.c
+++ b/tc/m_ct.c
@@ -359,7 +359,7 @@  static void ct_print_nat(int ct_action, struct rtattr **tb)
 {
 	size_t done = 0;
 	char out[256] = "";
-	bool nat;
+	bool nat = false;
 
 	if (!(ct_action & TCA_CT_ACT_NAT))
 		return;