Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1096411imm; Fri, 27 Jul 2018 11:02:40 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcY58FnD5lVHfOs+DpL9s3sL0iz5Gwhiwb4eHKXU8w02mGEAbUeTxtZosJBW3jaJsnKMsXD X-Received: by 2002:a62:ea05:: with SMTP id t5-v6mr7640301pfh.228.1532714560501; Fri, 27 Jul 2018 11:02:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532714560; cv=none; d=google.com; s=arc-20160816; b=ZE+c4lmWFLg5Ulx7Fe8buxGEouw+yz57jEkjf56/us1bQ+pngKgc6OZxRNCC4N60XK 1/bhiiplPbIw1tdjElVHrtAw0o4tK/Y2TjKfd18KIG8AKYjHLDnuN9FfW9/tE6hGP1rO 3sdKtk/K124s92qS5a8fWKED9QpzyFY7mmDsTN7uY5AEgKSAwP/0vkMcFwHDau4wdkxy P8vUtSw9h5UNP1yewKC5MRTloj4oS0Ivxw0X8MHrv9rqqP7mZ8OUb+OHhZVJnIO2rEc5 IZsswsgf7LTYNdRVPTxRxtqD0r/TV3y9WQh88aEtCYhE8Cmfl7XORKB+3tAhlz+ryS4r 3mng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature:arc-authentication-results; bh=ca7VtAOr5CbyNXYw+EYnGz1kTQzO9N05tUUdLE7DFCk=; b=PvTYdZfPGHQjpXt8yeFqH4t2MIpshpsJiHk5gXNY8WcN4YXWzyDCk1OPGOhz8abrZJ TIArvE8Mv2231mW+W53tQWCOYBp1nT4IVI3SLoJG9Q+ZSgJhjxEamWnBE0r7d/g1C3r2 9O5qU613vuRKQ97D3OAtBtts+gmFSNiQ8GO9eL5nm0HTh/r6VZ5zl0SfnGGdkHgeTDG2 6weRXrhQHjakdMRwntFGm/zkmPWPesbgl8WF/mYj1mAwcHj2ljMgtYL2Xtwzfok6EkCP qSnp9m429YVGZXEWMWe6fWd/tK5ActmkjkGl+B1lXEJfIZHCRORUvrtsYl7ylb60RmvO wEUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@netronome-com.20150623.gappssmtp.com header.s=20150623 header.b=k4hXs9Wl; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x11-v6si3576375pln.130.2018.07.27.11.02.02; Fri, 27 Jul 2018 11:02:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@netronome-com.20150623.gappssmtp.com header.s=20150623 header.b=k4hXs9Wl; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389146AbeG0TWZ (ORCPT + 99 others); Fri, 27 Jul 2018 15:22:25 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:39040 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389067AbeG0TWZ (ORCPT ); Fri, 27 Jul 2018 15:22:25 -0400 Received: by mail-pg1-f194.google.com with SMTP id a11-v6so3657298pgw.6 for ; Fri, 27 Jul 2018 10:59:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netronome-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :organization:mime-version:content-transfer-encoding; bh=ca7VtAOr5CbyNXYw+EYnGz1kTQzO9N05tUUdLE7DFCk=; b=k4hXs9WlXdONJpuVYpqEB8Z2x1EHYmErOjR3b/pYJrWjbgscG7dRaS1PsrGvqTyP7n /+hwewD30QQvyhcYGMra0hdRdxgD9juAHGk9svJktGE44+Xw13TNhlQ8KNPWeaUEsLbc 5trjbpbwU7q+WZeatgeejahgZufaHX0+Gr3dSxsuRR44To8UPeyv8K6vi34XJYPRo6vy zBTdHsvDD0jVKbAX5Ye29wO3gFIt9y/sop0XyY+Yf3NCn6WIHMPX+dwUTJwJQJyy1Ygq /jj76zIQ3E3WEQhLWUUD3yjwuKQGDap+1FO8OL7bXArxZiNAMJxp9sZM+an/1X8WjL0Z Uhmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:organization:mime-version:content-transfer-encoding; bh=ca7VtAOr5CbyNXYw+EYnGz1kTQzO9N05tUUdLE7DFCk=; b=kTNcTu/y8bseHk1FrD6/zyFwERiI7bwoFIR0dW0Tzw+hULpk8eEjY+mg/uv9Atcjf6 GqcKykMht14jdMwN7/q9lqODOUdZMXJ4Flqb2nVAK6f+JYJCfv47kYCBj1weTQnGhaLn EDvlCYbNRNYHOJNJLK5AAzEBXt7aJH9g1ifV/yO1JqQMhwFMgbuCG0V1B8XvPAGZjtXM nJWP6YWuBmM2PEfUi/AQ8mHqH8YqAFDwPE5D0UCrtAMVlEcC3rjL5lvOTdUZNy9wvBPm Evq0PLfQCSE3VZlifN7mxacrCpiZhA1Ff1Kz4tYWXXKpRhWM58et99nCc+qdqkZFOBlh VtTw== X-Gm-Message-State: AOUpUlEDi68mqeC2PLQ1x2PMaJyRmBxt11ys//GrKizBChKjo/DeC8hQ vNSSUE9rNL1Md/P8sLX8DaWw4g== X-Received: by 2002:a62:3d41:: with SMTP id k62-v6mr7649586pfa.35.1532714365982; Fri, 27 Jul 2018 10:59:25 -0700 (PDT) Received: from cakuba.netronome.com (c-73-231-89-118.hsd1.ca.comcast.net. [73.231.89.118]) by smtp.gmail.com with ESMTPSA id l79-v6sm14440885pfj.179.2018.07.27.10.59.25 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 27 Jul 2018 10:59:25 -0700 (PDT) Date: Fri, 27 Jul 2018 10:59:23 -0700 From: Jakub Kicinski To: Thomas Richter 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 Message-ID: <20180727105923.2d5da6aa@cakuba.netronome.com> In-Reply-To: <20180727082126.87530-1-tmricht@linux.ibm.com> References: <20180727082126.87530-1-tmricht@linux.ibm.com> Organization: Netronome Systems, Ltd. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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=3D"-Wp,-D_FORTIFY_SOURCE=3D2 -O2" > causes a compiler error. It is the warning > 'variable may be used uninitialized' > which is treated as error: >=20 > 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) >=20 > The file that causes the error is tools/lib/bpf/libbpf.c >=20 > Here is the error message: >=20 > [root@p23lp27] # make V=3D1 EXTRA_CFLAGS=3D"-Wp,-D_FORTIFY_SOURCE=3D2 -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 =E2=80=98bpf_perf_event_read_simple=E2=80=99: > libbpf.c:2342:6: error: =E2=80=98ret=E2=80=99 may be used uninitialized i= n this > function [-Werror=3Dmaybe-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 targe= t 'libbpf.o' failed >=20 > Fix this warning and add an addition check at the beginning > of the while loop. >=20 > Cc: Alexei Starovoitov > Cc: Daniel Borkmann >=20 > Suggested-by: Jakub Kicinski > Signed-off-by: Thomas Richter Ah, you already sent this, LGTM, thanks Thomas! > tools/lib/bpf/libbpf.c | 2 ++ > 1 file changed, 2 insertions(+) >=20 > 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, > =20 > begin =3D base + data_tail % size; > end =3D base + data_head % size; > + if (begin =3D=3D end) > + return LIBBPF_PERF_EVENT_ERROR; > =20 > while (begin !=3D end) { > struct perf_event_header *ehdr;