public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Daniel Borkmann <daniel@iogearbox.net>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>,
	Shaohua Li <shli@fb.com>
Cc: linux-kernel@vger.kernel.org, akpm@linux-foundation.org,
	Tejun Heo <tj@kernel.org>, Alexei Starovoitov <ast@kernel.org>
Subject: Re: [PATCH trival 1/2] bpf: clean up put_cpu_var usage
Date: Tue, 27 Sep 2016 12:52:38 +0200	[thread overview]
Message-ID: <57EA4F76.80405@iogearbox.net> (raw)
In-Reply-To: <20160926235157.GB58431@ast-mbp.thefacebook.com>

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 <tj@kernel.org>
>> Cc: Alexei Starovoitov <ast@kernel.org>
>> Signed-off-by: Shaohua Li <shli@fb.com>
>
> 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
>>

      reply	other threads:[~2016-09-27 10:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-26 18:14 [PATCH trival 1/2] bpf: clean up put_cpu_var usage Shaohua Li
2016-09-26 18:14 ` [PATCH trival 2/2] lib: " Shaohua Li
2016-09-26 23:51 ` [PATCH trival 1/2] bpf: " Alexei Starovoitov
2016-09-27 10:52   ` Daniel Borkmann [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=57EA4F76.80405@iogearbox.net \
    --to=daniel@iogearbox.net \
    --cc=akpm@linux-foundation.org \
    --cc=alexei.starovoitov@gmail.com \
    --cc=ast@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=shli@fb.com \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox