netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH trival -resend 1/2] bpf: clean up put_cpu_var usage
@ 2016-09-27 15:42 Shaohua Li
  2016-09-27 15:42 ` [PATCH trival -resend 2/2] lib: " Shaohua Li
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Shaohua Li @ 2016-09-27 15:42 UTC (permalink / raw)
  To: linux-kernel, netdev
  Cc: David S . Miller, akpm, Tejun Heo, Alexei Starovoitov

put_cpu_var takes the percpu data, not the data returned from
get_cpu_var.

This doesn't change the behavior.

Cc: Tejun Heo <tj@kernel.org>
Cc: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Shaohua Li <shli@fb.com>
---
 kernel/bpf/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c
index 7b7baae..aa6d981 100644
--- a/kernel/bpf/core.c
+++ b/kernel/bpf/core.c
@@ -1031,7 +1031,7 @@ BPF_CALL_0(bpf_user_rnd_u32)
 
 	state = &get_cpu_var(bpf_user_rnd_state);
 	res = prandom_u32_state(state);
-	put_cpu_var(state);
+	put_cpu_var(bpf_user_rnd_state);
 
 	return res;
 }
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-09-28  2:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-27 15:42 [PATCH trival -resend 1/2] bpf: clean up put_cpu_var usage Shaohua Li
2016-09-27 15:42 ` [PATCH trival -resend 2/2] lib: " Shaohua Li
2016-09-27 23:16   ` Tejun Heo
2016-09-28  2:10   ` David Miller
2016-09-27 23:02 ` [PATCH trival -resend 1/2] bpf: " Alexei Starovoitov
2016-09-27 23:15 ` Tejun Heo
2016-09-28  2:10 ` 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).