[<prev] [next>] [day] [month] [year] [list]
Message-ID: <tip-psf4xwc09n62al2cb9s33v9h@git.kernel.org>
Date: Wed, 16 May 2018 11:05:54 -0700
From: tip-bot for YueHaibing <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: hpa@...or.com, namhyung@...nel.org, linux-kernel@...r.kernel.org,
peterz@...radead.org, yuehaibing@...wei.com, acme@...hat.com,
tglx@...utronix.de, alexander.shishkin@...ux.intel.com,
mingo@...nel.org, daniel@...earbox.net
Subject: [tip:perf/core] perf bpf: Fix NULL return handling in
bpf__prepare_load()
Commit-ID: 7a36a287de9fbb1ba906e70573d3f2315f7fd609
Gitweb: https://git.kernel.org/tip/7a36a287de9fbb1ba906e70573d3f2315f7fd609
Author: YueHaibing <yuehaibing@...wei.com>
AuthorDate: Fri, 11 May 2018 19:21:42 +0800
Committer: Arnaldo Carvalho de Melo <acme@...hat.com>
CommitDate: Wed, 16 May 2018 10:01:55 -0300
perf bpf: Fix NULL return handling in bpf__prepare_load()
bpf_object__open()/bpf_object__open_buffer can return error pointer or
NULL, check the return values with IS_ERR_OR_NULL() in bpf__prepare_load
and bpf__prepare_load_buffer
Signed-off-by: YueHaibing <yuehaibing@...wei.com>
Acked-by: Daniel Borkmann <daniel@...earbox.net>
Cc: Alexander Shishkin <alexander.shishkin@...ux.intel.com>
Cc: Namhyung Kim <namhyung@...nel.org>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: netdev@...r.kernel.org
Link: https://lkml.kernel.org/n/tip-psf4xwc09n62al2cb9s33v9h@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
tools/perf/util/bpf-loader.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/perf/util/bpf-loader.c b/tools/perf/util/bpf-loader.c
index af7ad814b2c3..cee658733e2c 100644
--- a/tools/perf/util/bpf-loader.c
+++ b/tools/perf/util/bpf-loader.c
@@ -66,7 +66,7 @@ bpf__prepare_load_buffer(void *obj_buf, size_t obj_buf_sz, const char *name)
}
obj = bpf_object__open_buffer(obj_buf, obj_buf_sz, name);
- if (IS_ERR(obj)) {
+ if (IS_ERR_OR_NULL(obj)) {
pr_debug("bpf: failed to load buffer\n");
return ERR_PTR(-EINVAL);
}
@@ -102,14 +102,14 @@ struct bpf_object *bpf__prepare_load(const char *filename, bool source)
pr_debug("bpf: successfull builtin compilation\n");
obj = bpf_object__open_buffer(obj_buf, obj_buf_sz, filename);
- if (!IS_ERR(obj) && llvm_param.dump_obj)
+ if (!IS_ERR_OR_NULL(obj) && llvm_param.dump_obj)
llvm__dump_obj(filename, obj_buf, obj_buf_sz);
free(obj_buf);
} else
obj = bpf_object__open(filename);
- if (IS_ERR(obj)) {
+ if (IS_ERR_OR_NULL(obj)) {
pr_debug("bpf: failed to load %s\n", filename);
return obj;
}
Powered by blists - more mailing lists