Skip to contentSkip to conversation

tc: fix warning in tc/m_ct.c

PATCH Applied Brian Vazquez 3 participants 3 messages Nov 27, 2019 – Dec 4, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tc: fix warning in tc/m_ct.c

Warning was:
m_ct.c:370:13: warning: variable 'nat' is used uninitialized whenever 'if' condition is false

Cc Paul Blakey <[email protected]>
Fixes c8a494314c40 ("tc: Introduce tc ct action")
---
 tc/m_ct.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tc/m_ct.c +1 -1
index 8df2f610..45fa4a8c 100644
@@ -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;
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
#1 lore raw
Quoted 16 lines · Brian Vazquez

Warning was:
m_ct.c:370:13: warning: variable 'nat' is used uninitialized whenever 'if' condition is false

Cc Paul Blakey <[email protected]>
Fixes c8a494314c40 ("tc: Introduce tc ct action")
---
  tc/m_ct.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
tc/m_ct.c +0 -0
index 8df2f610..45fa4a8c 100644

tc/m_ct.c static void ct_print_nat(int ct_action, struct rtattr **tb) · line 365

Quoted 8 lines
tc/m_ct.c +1 -1
@@ -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.