cocci: Fix false positive in null.cocci
cocci: Fix false positive in null.cocci

This commit fixes a false positive in null.cocci, when the NULL variable
is assigned before being dereferenced. This change was tested with the
following change, originally introduced in #12415, to trigger the false
positive.

    diff --git a/bpf/bpf_sock.c b/bpf/bpf_sock.c
    index d2ad4ceea..ec3c3063a 100644
    --- a/bpf/bpf_sock.c
    +++ b/bpf/bpf_sock.c
    @@ -265,7 +265,7 @@ static __always_inline int __sock4_xlate_fwd(struct bpf_sock_addr *ctx,
            svc = lb4_lookup_service(&key, true);
            if (!svc) {
                    svc = sock4_nodeport_wildcard_lookup(&key, true, in_hostns);
    -               if (svc && !lb4_svc_is_nodeport(svc))
    +               if (svc && !(svc->flags & SVC_CHECK_NODEPORT))
                            svc = NULL;
            }
            if (!svc)

Fixes: 96d2d5a ("bpf: add cocci script to find wrong null checks")
Reported-by: Daniel Borkmann <3d0f3b9ddcacec30c4008c5e030e6c13a478cb4f@iogearbox.net>
Signed-off-by: Paul Chaignon <a027184a55211cd23e3f3094f1fdc728df5e0500@cilium.io>

cilium/cilium,tgraf/cilium,michi-covalent/cilium,tgraf/cilium,michi-covalent/cilium,tgraf/cilium,tgraf/cilium,cilium/cilium,cilium/cilium,tklauser/cilium,michi-covalent/cilium,cilium-team/cilium,michi-covalent/cilium,tgraf/cilium,cilium/cilium,cilium/cilium,tklauser/cilium,tklauser/cilium,tklauser/cilium,tgraf/cilium,michi-covalent/cilium,tklauser/cilium,cilium-team/cilium