* [patch -next] tcp_memcontrol: fix reversed if condition
@ 2011-12-15 11:05 Dan Carpenter
2011-12-15 17:01 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2011-12-15 11:05 UTC (permalink / raw)
To: Glauber Costa
Cc: David S. Miller, Alexey Kuznetsov, James Morris,
Hideaki YOSHIFUJI, Patrick McHardy, netdev, kernel-janitors
We should only dereference the pointer if it's valid, not the other way
round.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/net/ipv4/tcp_memcontrol.c b/net/ipv4/tcp_memcontrol.c
index 171d7b6..7fed04f 100644
--- a/net/ipv4/tcp_memcontrol.c
+++ b/net/ipv4/tcp_memcontrol.c
@@ -44,7 +44,7 @@ static inline struct tcp_memcontrol *tcp_from_cgproto(struct cg_proto *cg_proto)
static void memcg_tcp_enter_memory_pressure(struct sock *sk)
{
- if (!sk->sk_cgrp->memory_pressure)
+ if (sk->sk_cgrp->memory_pressure)
*sk->sk_cgrp->memory_pressure = 1;
}
EXPORT_SYMBOL(memcg_tcp_enter_memory_pressure);
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [patch -next] tcp_memcontrol: fix reversed if condition
2011-12-15 11:05 [patch -next] tcp_memcontrol: fix reversed if condition Dan Carpenter
@ 2011-12-15 17:01 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2011-12-15 17:01 UTC (permalink / raw)
To: dan.carpenter
Cc: glommer, kuznet, jmorris, yoshfuji, kaber, netdev,
kernel-janitors
From: Dan Carpenter <dan.carpenter@oracle.com>
Date: Thu, 15 Dec 2011 14:05:10 +0300
> We should only dereference the pointer if it's valid, not the other way
> round.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
It's nice to see how thoroughly this code has been tested, sigh...
Applied, thanks a lot Dan.
> diff --git a/net/ipv4/tcp_memcontrol.c b/net/ipv4/tcp_memcontrol.c
> index 171d7b6..7fed04f 100644
> --- a/net/ipv4/tcp_memcontrol.c
> +++ b/net/ipv4/tcp_memcontrol.c
> @@ -44,7 +44,7 @@ static inline struct tcp_memcontrol *tcp_from_cgproto(struct cg_proto *cg_proto)
>
> static void memcg_tcp_enter_memory_pressure(struct sock *sk)
> {
> - if (!sk->sk_cgrp->memory_pressure)
> + if (sk->sk_cgrp->memory_pressure)
> *sk->sk_cgrp->memory_pressure = 1;
> }
> EXPORT_SYMBOL(memcg_tcp_enter_memory_pressure);
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-12-15 17:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-15 11:05 [patch -next] tcp_memcontrol: fix reversed if condition Dan Carpenter
2011-12-15 17:01 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).