linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] netfilter: conntrack: Pass value of ctinfo to __nf_conntrack_update
@ 2020-05-27  8:10 Nathan Chancellor
  2020-05-27  9:52 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 2+ messages in thread
From: Nathan Chancellor @ 2020-05-27  8:10 UTC (permalink / raw)
  To: Pablo Neira Ayuso, Jozsef Kadlecsik, Florian Westphal,
	David S. Miller, Jakub Kicinski
  Cc: netfilter-devel, coreteam, netdev, linux-kernel,
	clang-built-linux, Nathan Chancellor

Clang warns:

net/netfilter/nf_conntrack_core.c:2068:21: warning: variable 'ctinfo' is
uninitialized when used here [-Wuninitialized]
        nf_ct_set(skb, ct, ctinfo);
                           ^~~~~~
net/netfilter/nf_conntrack_core.c:2024:2: note: variable 'ctinfo' is
declared here
        enum ip_conntrack_info ctinfo;
        ^
1 warning generated.

nf_conntrack_update was split up into nf_conntrack_update and
__nf_conntrack_update, where the assignment of ctifno is in
nf_conntrack_update but it is used in __nf_conntrack_update.

Pass the value of ctinfo from nf_conntrack_update to
__nf_conntrack_update so that uninitialized memory is not used
and everything works properly.

Fixes: ee04805ff54a ("netfilter: conntrack: make conntrack userspace helpers work again")
Link: https://github.com/ClangBuiltLinux/linux/issues/1039
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
---
 net/netfilter/nf_conntrack_core.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
index 08e0c19f6b39..e3b054a2f796 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -2017,11 +2017,11 @@ static void nf_conntrack_attach(struct sk_buff *nskb, const struct sk_buff *skb)
 }
 
 static int __nf_conntrack_update(struct net *net, struct sk_buff *skb,
-				 struct nf_conn *ct)
+				 struct nf_conn *ct,
+				 enum ip_conntrack_info ctinfo)
 {
 	struct nf_conntrack_tuple_hash *h;
 	struct nf_conntrack_tuple tuple;
-	enum ip_conntrack_info ctinfo;
 	struct nf_nat_hook *nat_hook;
 	unsigned int status;
 	int dataoff;
@@ -2146,7 +2146,7 @@ static int nf_conntrack_update(struct net *net, struct sk_buff *skb)
 		return 0;
 
 	if (!nf_ct_is_confirmed(ct)) {
-		err = __nf_conntrack_update(net, skb, ct);
+		err = __nf_conntrack_update(net, skb, ct, ctinfo);
 		if (err < 0)
 			return err;
 	}

base-commit: a4976a3ef844c510ae9120290b23e9f3f47d6bce
-- 
2.27.0.rc0


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

* Re: [PATCH net] netfilter: conntrack: Pass value of ctinfo to __nf_conntrack_update
  2020-05-27  8:10 [PATCH net] netfilter: conntrack: Pass value of ctinfo to __nf_conntrack_update Nathan Chancellor
@ 2020-05-27  9:52 ` Pablo Neira Ayuso
  0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2020-05-27  9:52 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Jozsef Kadlecsik, Florian Westphal, David S. Miller,
	Jakub Kicinski, netfilter-devel, coreteam, netdev, linux-kernel,
	clang-built-linux

On Wed, May 27, 2020 at 01:10:39AM -0700, Nathan Chancellor wrote:
> Clang warns:
> 
> net/netfilter/nf_conntrack_core.c:2068:21: warning: variable 'ctinfo' is
> uninitialized when used here [-Wuninitialized]
>         nf_ct_set(skb, ct, ctinfo);
>                            ^~~~~~
> net/netfilter/nf_conntrack_core.c:2024:2: note: variable 'ctinfo' is
> declared here
>         enum ip_conntrack_info ctinfo;
>         ^
> 1 warning generated.
> 
> nf_conntrack_update was split up into nf_conntrack_update and
> __nf_conntrack_update, where the assignment of ctifno is in
> nf_conntrack_update but it is used in __nf_conntrack_update.
> 
> Pass the value of ctinfo from nf_conntrack_update to
> __nf_conntrack_update so that uninitialized memory is not used
> and everything works properly.

Applied, thanks.

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

end of thread, other threads:[~2020-05-27  9:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-27  8:10 [PATCH net] netfilter: conntrack: Pass value of ctinfo to __nf_conntrack_update Nathan Chancellor
2020-05-27  9:52 ` Pablo Neira Ayuso

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