All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@redhat.com>
To: Yonghong Song <yhs@fb.com>
Cc: Andrii Nakryiko <andriin@fb.com>, Jiri Olsa <jolsa@kernel.org>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"bpf@vger.kernel.org" <bpf@vger.kernel.org>,
	Martin Lau <kafai@fb.com>
Subject: Re: [PATCH] bpftool: Try to read btf as raw data if elf read fails
Date: Mon, 21 Oct 2019 15:55:02 +0200	[thread overview]
Message-ID: <20191021135502.GC32718@krava> (raw)
In-Reply-To: <78433b38-3f34-c97a-ee74-a9b6dee95aa2@fb.com>

On Fri, Oct 18, 2019 at 08:04:44PM +0000, Yonghong Song wrote:

SNIP

> >> +	FILE *f;
> >> +
> >> +	if (stat(file, &st))
> >> +		return btf;
> >> +
> >> +	f = fopen(file, "rb");
> >> +	if (!f)
> >> +		return btf;
> >> +
> >> +	buf = malloc(st.st_size);
> >> +	if (!buf)
> >> +		goto err;
> >> +
> >> +	if ((size_t) st.st_size != fread(buf, 1, st.st_size, f))
> >> +		goto err;
> >> +
> >> +	btf = btf__new(buf, st.st_size);
> >> +
> >> +err:
> 
> Non error case can also reach here. Let us change
> label to a different name, e.g., "done"?

ok, will change

thanks,
jirka


  reply	other threads:[~2019-10-21 13:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-18 10:34 [PATCH] bpftool: Try to read btf as raw data if elf read fails Jiri Olsa
2019-10-18 16:48 ` Andrii Nakryiko
2019-10-18 20:04   ` Yonghong Song
2019-10-21 13:55     ` Jiri Olsa [this message]
2019-10-21 13:54   ` Jiri Olsa
2019-10-18 22:39 ` Jakub Kicinski
2019-10-21 14:02   ` Jiri Olsa
2019-10-21 23:16     ` Jakub Kicinski

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=20191021135502.GC32718@krava \
    --to=jolsa@redhat.com \
    --cc=andriin@fb.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=jolsa@kernel.org \
    --cc=kafai@fb.com \
    --cc=netdev@vger.kernel.org \
    --cc=yhs@fb.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.