re: netfilter: nfnetlink_queue: resolve clash for unconfirmed conntracks

From: Colin Ian King
Date: Tue May 26 2020 - 14:22:03 EST


Static analysis with Coverity has detected a potential issue with the
commit in linux-next:

commit 368982cd7d1bd41cd39049c794990aca3770db44
Author: Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx>
Date: Wed May 23 09:17:24 2018 +0200

netfilter: nfnetlink_queue: resolve clash for unconfirmed conntracks


2019 static int __nf_conntrack_update(struct net *net, struct sk_buff *skb,
2020 struct nf_conn *ct)
2021 {
2022 struct nf_conntrack_tuple_hash *h;
2023 struct nf_conntrack_tuple tuple;

1. var_decl: Declaring variable ctinfo without initializer.

2024 enum ip_conntrack_info ctinfo;


2066 nf_ct_put(ct);
2067 ct = nf_ct_tuplehash_to_ctrack(h);

Uninitialized scalar variable (UNINIT)7. uninit_use_in_call:
Using uninitialized value ctinfo when calling nf_ct_set.

2068 nf_ct_set(skb, ct, ctinfo);

the call to nf_ct_set uses info as follows:

316 static inline void
317 nf_ct_set(struct sk_buff *skb, struct nf_conn *ct, enum
ip_conntrack_info info)
318 {
319 skb_set_nfct(skb, (unsigned long)ct | info);
320 }

so this shows that the info arg (from ctinfo) is being used when it has
not been initialized.