2007-10-14 17:54:10

by Adrian Bunk

[permalink] [raw]
Subject: [2.6 patch] __inet6_csk_dst_store(): fix check-after-use

The Coverity checker spotted that we have already oops'ed if "dst"
was NULL.

Since "dst" being NULL doesn't seem to be possible at this point this
patch removes the NULL check.

Signed-off-by: Adrian Bunk <[email protected]>

---
eeb6009cf3ef5f6993ced359330d877680617a70
diff --git a/net/ipv6/inet6_connection_sock.c b/net/ipv6/inet6_connection_sock.c
index 25b9317..78de42a 100644
--- a/net/ipv6/inet6_connection_sock.c
+++ b/net/ipv6/inet6_connection_sock.c
@@ -146,7 +146,7 @@ void __inet6_csk_dst_store(struct sock *sk, struct dst_entry *dst,
__ip6_dst_store(sk, dst, daddr, saddr);

#ifdef CONFIG_XFRM
- if (dst) {
+ {
struct rt6_info *rt = (struct rt6_info *)dst;
rt->rt6i_flow_cache_genid = atomic_read(&flow_cache_genid);
}


2007-10-15 03:04:30

by Masahide NAKAMURA

[permalink] [raw]
Subject: Re: [2.6 patch] __inet6_csk_dst_store(): fix check-after-use


On Sun, 14 Oct 2007 19:52:12 +0200
Adrian Bunk <[email protected]> wrote:

> The Coverity checker spotted that we have already oops'ed if "dst"
> was NULL.
>
> Since "dst" being NULL doesn't seem to be possible at this point this
> patch removes the NULL check.
>
> Signed-off-by: Adrian Bunk <[email protected]>

Agreed.

Acked-by: Masahide NAKAMURA <[email protected]>

--
Masahide NAKAMURA

2007-10-15 03:57:16

by Noriaki TAKAMIYA

[permalink] [raw]
Subject: Re: [2.6 patch] __inet6_csk_dst_store(): fix check-after-use

Hi,

>> Mon, 15 Oct 2007 11:45:10 +0900
>> [Subject: Re: [2.6 patch] __inet6_csk_dst_store(): fix check-after-use]
>> Masahide NAKAMURA <[email protected]> wrote...

>
> On Sun, 14 Oct 2007 19:52:12 +0200
> Adrian Bunk <[email protected]> wrote:
>
> > The Coverity checker spotted that we have already oops'ed if "dst"
> > was NULL.
> >
> > Since "dst" being NULL doesn't seem to be possible at this point this
> > patch removes the NULL check.
> >
> > Signed-off-by: Adrian Bunk <[email protected]>
>
> Agreed.
>
> Acked-by: Masahide NAKAMURA <[email protected]>

I also agreed.

Acked-by: Noriaki TAKAMIYA <[email protected]>

--
Noriaki TAKAMIYA

2007-10-15 08:38:22

by David Miller

[permalink] [raw]
Subject: Re: [2.6 patch] __inet6_csk_dst_store(): fix check-after-use

From: Noriaki TAKAMIYA <[email protected]>
Date: Mon, 15 Oct 2007 12:37:49 +0900 (JST)

> >
> > On Sun, 14 Oct 2007 19:52:12 +0200
> > Adrian Bunk <[email protected]> wrote:
> >
> > > The Coverity checker spotted that we have already oops'ed if "dst"
> > > was NULL.
> > >
> > > Since "dst" being NULL doesn't seem to be possible at this point this
> > > patch removes the NULL check.
> > >
> > > Signed-off-by: Adrian Bunk <[email protected]>
> >
> > Agreed.
> >
> > Acked-by: Masahide NAKAMURA <[email protected]>
>
> I also agreed.
>
> Acked-by: Noriaki TAKAMIYA <[email protected]>

Patch applied, thanks everyone!