linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <jakub.kicinski@netronome.com>
To: Thomas Richter <tmricht@linux.ibm.com>
Cc: daniel@iogearbox.net, ast@kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, heiko.carstens@de.ibm.com,
	brueckner@linux.vnet.ibm.com, schwidefsky@de.ibm.com
Subject: Re: [PATCH] perf build: Build error in libbpf missing initialization
Date: Fri, 27 Jul 2018 10:59:23 -0700	[thread overview]
Message-ID: <20180727105923.2d5da6aa@cakuba.netronome.com> (raw)
In-Reply-To: <20180727082126.87530-1-tmricht@linux.ibm.com>

On Fri, 27 Jul 2018 10:21:26 +0200, Thomas Richter wrote:
> In linux-next tree compiling the perf tool with additional make flags
> "EXTRA_CFLAGS="-Wp,-D_FORTIFY_SOURCE=2 -O2"
> causes a compiler error. It is the warning
> 	'variable may be used uninitialized'
> which is treated as error:
> 
> I compile it using a FEDORA 28 installation, my gcc compiler version:
> gcc (GCC) 8.0.1 20180324 (Red Hat 8.0.1-0.20)
> 
> The file that causes the error is tools/lib/bpf/libbpf.c
> 
> Here is the error message:
> 
> [root@p23lp27] # make V=1 EXTRA_CFLAGS="-Wp,-D_FORTIFY_SOURCE=2 -O2"
> [...]
> Makefile.config:849: No openjdk development package found, please
>    install JDK package, e.g. openjdk-8-jdk, java-1.8.0-openjdk-devel
> Warning: Kernel ABI header at 'tools/include/uapi/linux/if_link.h'
>         differs from latest version at 'include/uapi/linux/if_link.h'
>   CC       libbpf.o
> libbpf.c: In function ‘bpf_perf_event_read_simple’:
> libbpf.c:2342:6: error: ‘ret’ may be used uninitialized in this
> 			function [-Werror=maybe-uninitialized]
>   int ret;
>       ^
> cc1: all warnings being treated as errors
> mv: cannot stat './.libbpf.o.tmp': No such file or directory
> /home6/tmricht/linux-next/tools/build/Makefile.build:96: recipe for target 'libbpf.o' failed
> 
> Fix this warning and add an addition check at the beginning
> of the while loop.
> 
> Cc: Alexei Starovoitov <ast@kernel.org>
> Cc: Daniel Borkmann <daniel@iogearbox.net>
> 
> Suggested-by: Jakub Kicinski <jakub.kicinski@netronome.com>
> Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>

Ah, you already sent this, LGTM, thanks Thomas!

>  tools/lib/bpf/libbpf.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
> index 73465caa33ba..66965ca96113 100644
> --- a/tools/lib/bpf/libbpf.c
> +++ b/tools/lib/bpf/libbpf.c
> @@ -2349,6 +2349,8 @@ bpf_perf_event_read_simple(void *mem, unsigned long size,
>  
>  	begin = base + data_tail % size;
>  	end = base + data_head % size;
> +	if (begin == end)
> +		return LIBBPF_PERF_EVENT_ERROR;
>  
>  	while (begin != end) {
>  		struct perf_event_header *ehdr;


  reply	other threads:[~2018-07-27 17:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-27  8:21 [PATCH] perf build: Build error in libbpf missing initialization Thomas Richter
2018-07-27 17:59 ` Jakub Kicinski [this message]
2018-07-27 19:31   ` Daniel Borkmann
2018-07-27 19:56     ` Jakub Kicinski
2018-07-28 19:30       ` Daniel Borkmann

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=20180727105923.2d5da6aa@cakuba.netronome.com \
    --to=jakub.kicinski@netronome.com \
    --cc=ast@kernel.org \
    --cc=brueckner@linux.vnet.ibm.com \
    --cc=daniel@iogearbox.net \
    --cc=heiko.carstens@de.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=schwidefsky@de.ibm.com \
    --cc=tmricht@linux.ibm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).