public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation•org>
To: linux-kernel@vger•kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation•org>,
	stable@vger•kernel.org, YueHaibing <yuehaibing@huawei•com>,
	Daniel Borkmann <daniel@iogearbox•net>,
	Alexander Shishkin <alexander.shishkin@linux•intel.com>,
	Namhyung Kim <namhyung@kernel•org>,
	Peter Zijlstra <peterz@infradead•org>,
	netdev@vger•kernel.org,
	Arnaldo Carvalho de Melo <acme@redhat•com>,
	Sasha Levin <alexander.levin@microsoft•com>
Subject: [PATCH 4.14 55/61] perf bpf: Fix NULL return handling in bpf__prepare_load()
Date: Fri,  6 Jul 2018 07:47:19 +0200	[thread overview]
Message-ID: <20180706054714.441305625@linuxfoundation.org> (raw)
In-Reply-To: <20180706054712.332416244@linuxfoundation.org>

4.14-stable review patch.  If anyone has any objections, please let me know.

------------------

From: YueHaibing <yuehaibing@huawei•com>

[ Upstream commit ab4e32ff5aa797eaea551dbb67946e2fcb56cc7e ]

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@huawei•com>
Acked-by: Daniel Borkmann <daniel@iogearbox•net>
Cc: Alexander Shishkin <alexander.shishkin@linux•intel.com>
Cc: Namhyung Kim <namhyung@kernel•org>
Cc: Peter Zijlstra <peterz@infradead•org>
Cc: netdev@vger•kernel.org
Link: https://lkml.kernel.org/n/tip-psf4xwc09n62al2cb9s33v9h@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat•com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft•com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation•org>
---
 tools/perf/util/bpf-loader.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--- 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,
 	}
 
 	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(con
 			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;
 	}

           reply	other threads:[~2018-07-06  5:47 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <20180706054712.332416244@linuxfoundation.org>]

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=20180706054714.441305625@linuxfoundation.org \
    --to=gregkh@linuxfoundation$(echo .)org \
    --cc=acme@redhat$(echo .)com \
    --cc=alexander.levin@microsoft$(echo .)com \
    --cc=alexander.shishkin@linux$(echo .)intel.com \
    --cc=daniel@iogearbox$(echo .)net \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=namhyung@kernel$(echo .)org \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=peterz@infradead$(echo .)org \
    --cc=stable@vger$(echo .)kernel.org \
    --cc=yuehaibing@huawei$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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