From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753853AbcI0Kwx (ORCPT ); Tue, 27 Sep 2016 06:52:53 -0400 Received: from www62.your-server.de ([213.133.104.62]:51978 "EHLO www62.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751039AbcI0Kwn (ORCPT ); Tue, 27 Sep 2016 06:52:43 -0400 Message-ID: <57EA4F76.80405@iogearbox.net> Date: Tue, 27 Sep 2016 12:52:38 +0200 From: Daniel Borkmann User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Alexei Starovoitov , Shaohua Li CC: linux-kernel@vger.kernel.org, akpm@linux-foundation.org, Tejun Heo , Alexei Starovoitov Subject: Re: [PATCH trival 1/2] bpf: clean up put_cpu_var usage References: <1474c666552accf475fc809b3525892e1ae88bfa.1474912742.git.shli@fb.com> <20160926235157.GB58431@ast-mbp.thefacebook.com> In-Reply-To: <20160926235157.GB58431@ast-mbp.thefacebook.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Authenticated-Sender: daniel@iogearbox.net Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Shaohua, On 09/27/2016 01:51 AM, Alexei Starovoitov wrote: > On Mon, Sep 26, 2016 at 11:14:50AM -0700, Shaohua Li wrote: >> put_cpu_var takes the percpu data, not the data returned from >> get_cpu_var. >> >> This doesn't change the behavior. >> >> Cc: Tejun Heo >> Cc: Alexei Starovoitov >> Signed-off-by: Shaohua Li > > Looks good. Nice catch. > Please rebase to net-next tree and send it to netdev list. +1 > Otherwise we'll have conflicts at the time of the merge window. While you're at it, the same kind of cleanup can be done for prandom_u32() and prandom_bytes(), so you could either squash that into this patch as well or make it two patches. Both for netdev. Thanks, Daniel >> --- >> 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 03fd23d..b73913b 100644 >> --- a/kernel/bpf/core.c >> +++ b/kernel/bpf/core.c >> @@ -1031,7 +1031,7 @@ u64 bpf_user_rnd_u32(u64 r1, u64 r2, u64 r3, u64 r4, u64 r5) >> >> 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 >>