2015-12-11 17:48:16

by Julia Lawall

[permalink] [raw]
Subject: [PATCH] bpf: constify bpf_verifier_ops structure

This bpf_verifier_ops structure is never modified, like the other
bpf_verifier_ops structures, so declare it as const.

Done with the help of Coccinelle.

Signed-off-by: Julia Lawall <[email protected]>

---
kernel/trace/bpf_trace.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c
index 4228fd3..45dd798 100644
--- a/kernel/trace/bpf_trace.c
+++ b/kernel/trace/bpf_trace.c
@@ -316,7 +316,7 @@ static bool kprobe_prog_is_valid_access(int off, int size, enum bpf_access_type
return true;
}

-static struct bpf_verifier_ops kprobe_prog_ops = {
+static const struct bpf_verifier_ops kprobe_prog_ops = {
.get_func_proto = kprobe_prog_func_proto,
.is_valid_access = kprobe_prog_is_valid_access,
};


2015-12-11 18:13:02

by Steven Rostedt

[permalink] [raw]
Subject: Re: [PATCH] bpf: constify bpf_verifier_ops structure

On Fri, 11 Dec 2015 18:35:59 +0100
Julia Lawall <[email protected]> wrote:

> This bpf_verifier_ops structure is never modified, like the other
> bpf_verifier_ops structures, so declare it as const.
>
> Done with the help of Coccinelle.

Thanks, I'll add this to my 4.5 queue.

-- Steve

>
> Signed-off-by: Julia Lawall <[email protected]>
>
> ---
> kernel/trace/bpf_trace.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c
> index 4228fd3..45dd798 100644
> --- a/kernel/trace/bpf_trace.c
> +++ b/kernel/trace/bpf_trace.c
> @@ -316,7 +316,7 @@ static bool kprobe_prog_is_valid_access(int off, int size, enum bpf_access_type
> return true;
> }
>
> -static struct bpf_verifier_ops kprobe_prog_ops = {
> +static const struct bpf_verifier_ops kprobe_prog_ops = {
> .get_func_proto = kprobe_prog_func_proto,
> .is_valid_access = kprobe_prog_is_valid_access,
> };

2015-12-11 18:18:21

by Daniel Borkmann

[permalink] [raw]
Subject: Re: [PATCH] bpf: constify bpf_verifier_ops structure

On 12/11/2015 06:35 PM, Julia Lawall wrote:
> This bpf_verifier_ops structure is never modified, like the other
> bpf_verifier_ops structures, so declare it as const.
>
> Done with the help of Coccinelle.
>
> Signed-off-by: Julia Lawall <[email protected]>

Thanks Julia!

Acked-by: Daniel Borkmann <[email protected]>

2015-12-11 18:18:42

by Alexei Starovoitov

[permalink] [raw]
Subject: Re: [PATCH] bpf: constify bpf_verifier_ops structure

On Fri, Dec 11, 2015 at 06:35:59PM +0100, Julia Lawall wrote:
> This bpf_verifier_ops structure is never modified, like the other
> bpf_verifier_ops structures, so declare it as const.
>
> Done with the help of Coccinelle.
>
> Signed-off-by: Julia Lawall <[email protected]>

Acked-by: Alexei Starovoitov <[email protected]>

Ingo, can you take it into tip ? Thanks!

2015-12-11 18:19:35

by Alexei Starovoitov

[permalink] [raw]
Subject: Re: [PATCH] bpf: constify bpf_verifier_ops structure

On Fri, Dec 11, 2015 at 01:12:56PM -0500, Steven Rostedt wrote:
> On Fri, 11 Dec 2015 18:35:59 +0100
> Julia Lawall <[email protected]> wrote:
>
> > This bpf_verifier_ops structure is never modified, like the other
> > bpf_verifier_ops structures, so declare it as const.
> >
> > Done with the help of Coccinelle.
>
> Thanks, I'll add this to my 4.5 queue.

emails crossed. this is also fine with me.