diff mbox series

[bpf-next] bpf: clean up bpf_prog_get_info_by_fd()

Message ID 20181210191750.2512135-1-songliubraving@fb.com
State Accepted, archived
Delegated to: BPF Maintainers
Headers show
Series [bpf-next] bpf: clean up bpf_prog_get_info_by_fd() | expand

Commit Message

Song Liu Dec. 10, 2018, 7:17 p.m. UTC
info.nr_jited_ksyms and info.nr_jited_func_lens cannot be 0 in these two
statements, so we don't need to check them.

Signed-off-by: Song Liu <songliubraving@fb.com>
---
 kernel/bpf/syscall.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Martin KaFai Lau Dec. 10, 2018, 9:44 p.m. UTC | #1
On Mon, Dec 10, 2018 at 11:17:50AM -0800, Song Liu wrote:
> info.nr_jited_ksyms and info.nr_jited_func_lens cannot be 0 in these two
> statements, so we don't need to check them.
Acked-by: Martin KaFai Lau <kafai@fb.com>
Alexei Starovoitov Dec. 10, 2018, 10:50 p.m. UTC | #2
On Mon, Dec 10, 2018 at 11:17:50AM -0800, Song Liu wrote:
> info.nr_jited_ksyms and info.nr_jited_func_lens cannot be 0 in these two
> statements, so we don't need to check them.
> 
> Signed-off-by: Song Liu <songliubraving@fb.com>

Applied, Thanks
diff mbox series

Patch

diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
index 19c88cff7880..a99a23bf5910 100644
--- a/kernel/bpf/syscall.c
+++ b/kernel/bpf/syscall.c
@@ -2209,7 +2209,7 @@  static int bpf_prog_get_info_by_fd(struct bpf_prog *prog,
 
 	ulen = info.nr_jited_ksyms;
 	info.nr_jited_ksyms = prog->aux->func_cnt ? : 1;
-	if (info.nr_jited_ksyms && ulen) {
+	if (ulen) {
 		if (bpf_dump_raw_ok()) {
 			unsigned long ksym_addr;
 			u64 __user *user_ksyms;
@@ -2240,7 +2240,7 @@  static int bpf_prog_get_info_by_fd(struct bpf_prog *prog,
 
 	ulen = info.nr_jited_func_lens;
 	info.nr_jited_func_lens = prog->aux->func_cnt ? : 1;
-	if (info.nr_jited_func_lens && ulen) {
+	if (ulen) {
 		if (bpf_dump_raw_ok()) {
 			u32 __user *user_lens;
 			u32 func_len, i;