Subject: Re: Coverity: nf_tables_addchain(): Memory - corruptions

From: Florian Westphal <[email-masked]>
Date: Tue, 8 Jun 2021 22:13:23 +0200

coverity-bot <[email-masked]> wrote:
> 2186     	nft_trans_chain_policy(trans) = NFT_CHAIN_POLICY_UNSET;
> 2187     	if (nft_is_base_chain(chain)) {
> vvv     CID 1505166:  Memory - corruptions  (UNINIT)
> vvv     Using uninitialized value "basechain".
> 2188     		basechain->ops.hook_ops_type = NF_HOOK_OP_NF_TABLES;
> 2189     		nft_trans_chain_policy(trans) = policy;

Hmm, I do not see how is_base_chain() can be true while basechain
pointer is garbage.

However its probably better for readability to move the NF_HOOK_OP_...
assignment closer to where the basechain ops are allocated.