bpf: clean up put_cpu_var usage
authorShaohua Li <shli@fb.com>
Tue, 27 Sep 2016 15:42:41 +0000 (08:42 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 28 Sep 2016 02:09:17 +0000 (22:09 -0400)
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>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
kernel/bpf/core.c

index 7b7baaed9ed418085c558d095d820be82ed66758..aa6d981541067d20f7dbe147ccd92532bfd97ee6 100644 (file)
@@ -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;
 }