Re: [PATCH] [v2] selinux: avoid uninitialized variable warning

From: Arnd Bergmann
Date: Mon Mar 25 2019 - 10:24:49 EST


On Mon, Mar 25, 2019 at 3:15 PM Paul Moore <paul@xxxxxxxxxxxxxx> wrote:
> On Mon, Mar 25, 2019 at 8:40 AM Arnd Bergmann <arnd@xxxxxxxx> wrote:
> > clang correctly points out a code path that would lead

> > -#if IS_ENABLED(CONFIG_IPV6)
> > - } else {
> > + rc = netlbl_conn_setattr(ep->base.sk, (void*)&addr4, &secattr);
> > + } else if (IS_ENABLED(CONFIG_IPV6)) {
>
> I thought we had talked about using an else-if statement like the one
> below, is there any reason why you changed it to just the IS_ENABLED()
> check? I liked the idea of explicitly checking the IP header version
> number before treating the packet as an IPv6 packet.
>
> else if (IS_ENABLED(CONFIG_IPV6) && ip_hdr(skb)->version == 6)

Ah of course, sorry for missing that important part when I revisited
the patch. I've sent a v3 now.

Arnd