Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp722936yba; Fri, 26 Apr 2019 07:45:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqxgkiOMUxYkdRvh3QAkrKg1wjcRWqBUk+0aKIgt96XCvHI6hJdb4Sxx6y1BFpbDMLRWcqIU X-Received: by 2002:a17:902:2b87:: with SMTP id l7mr46650075plb.130.1556289934601; Fri, 26 Apr 2019 07:45:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556289934; cv=none; d=google.com; s=arc-20160816; b=EIdw1aU5qOQj4pMgCJtbtTzHCoKLKMrmfqEdbvKrzUpI//8T6rOiQhLVNIS90RCX32 tY9zfQy0OZJEQsEh/SrDl/0JXN24uwjqv0dPwWfbKYoUbV+fcvSXpsSiZex6aw5T5MyX 4erPcqQkCOd41N7PhNiqud5G4NwHv7TNZzVbADlO/B0+YR33fMKfNMB/h5Tw0oq5FihX pN3M13NO17REV9T2GZlzGT2RSuerx+CjyqCWWmea2NZNdRr4Wj9mY9BNPCnPbtYNLu5Y g4z1w3SBgGQT8NKzGXFMXzxCNaTxUnq2Jh8d2QdhKlQsXT0mqPyW6jxAfyxZMiRTkyR/ yhVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=/SrF2/LXInz9RmtMn9Zr9pb5eGqNOpPdmf377emad8E=; b=NbC1lPIfgRaurNOFxt2fS35ZKw0v8sGLVes/+eKI0b1RMamggBQj1uI/LoJw0LHvSF 4NEG0hvz/qkpEEAb29kyFAGQUjePRYWfIwzgPLmLINguZprHOVWONt77hB1ekszfucy9 +DF+TyjF61J7yrVyduMbIPdmORHdRollc6cW/FoS77ThkkKOjsGJkj5cFtQiisg9mKMl PvZX/oldKfOB3UCM4G0QXjkI3WxWINcjF6FbDvimESQapqW8XMWOzkjOvyTnl47NDP3o PQPSLa9dn3snhxy3MZd2c8eTKAwVMoKlOrMTuWrsmt4mBmwUhbh407ohT6V4C2EgHvmc lGrw== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u8si24618776pgo.122.2019.04.26.07.45.19; Fri, 26 Apr 2019 07:45:34 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726289AbfDZOoJ (ORCPT + 99 others); Fri, 26 Apr 2019 10:44:09 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56388 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726039AbfDZOoJ (ORCPT ); Fri, 26 Apr 2019 10:44:09 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B71803005FE7; Fri, 26 Apr 2019 14:44:08 +0000 (UTC) Received: from krava (unknown [10.40.205.252]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2A511277C2; Fri, 26 Apr 2019 14:44:07 +0000 (UTC) Date: Fri, 26 Apr 2019 16:44:06 +0200 From: Jiri Olsa To: Arnaldo Carvalho de Melo Cc: Thomas Richter , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, brueckner@linux.vnet.ibm.com, schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com Subject: Re: [PATCH] perf/report: Report OOM in perf report status line Message-ID: <20190426144406.GD12922@krava> References: <20190423105303.61683-1-tmricht@linux.ibm.com> <20190426140907.GB22086@kernel.org> <20190426141032.GA23426@kernel.org> <20190426141607.GB23426@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190426141607.GB23426@kernel.org> User-Agent: Mutt/1.11.3 (2019-02-01) X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Fri, 26 Apr 2019 14:44:08 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 26, 2019 at 11:16:07AM -0300, Arnaldo Carvalho de Melo wrote: SNIP > > util/session.c: In function ‘perf_session__process_events’: > > util/session.c:1936:7: error: ‘skip’ may be used uninitialized in this function [-Werror=maybe-uninitialized] > > err = skip; > > ~~~~^~~~~~ > > util/session.c:1874:6: note: ‘skip’ was declared here > > s64 skip; > > ^~~~ > > cc1: all warnings being treated as errors > > mv: cannot stat '/tmp/build/perf/util/.session.o.tmp': No such file or directory > > make[4]: *** [/home/acme/git/perf/tools/build/Makefile.build:96: /tmp/build/perf/util/session.o] Error 1 > > make[3]: *** [/home/acme/git/perf/tools/build/Makefile.build:139: util] Error 2 > > make[2]: *** [Makefile.perf:559: /tmp/build/perf/perf-in.o] Error 2 > > make[1]: *** [Makefile.perf:215: sub-make] Error 2 > > make: *** [Makefile:110: install-bin] Error 2 > > make: Leaving directory '/home/acme/git/perf/tools/perf' > > So, here is your patch: > > diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c > index b17f1c9bc965..e89716175588 100644 > --- a/tools/perf/util/session.c > +++ b/tools/perf/util/session.c > @@ -1930,10 +1930,10 @@ reader__process_events(struct reader *rd, struct perf_session *session, > > if (size < sizeof(struct perf_event_header) || > (skip = rd->process(session, event, file_pos)) < 0) { > - pr_err("%#" PRIx64 " [%#x]: failed to process type: %d\n", > + pr_err("%#" PRIx64 " [%#x]: failed to process type: %d [%s]\n", > file_offset + head, event->header.size, > - event->header.type); > - err = -EINVAL; > + event->header.type, strerror(-skip)); > + err = skip; > goto out; > } > > [acme@quaco perf]$ > > What happens if (size < sizeof(struct perf_event_header)) is true? size > will have an undefined value, so the right thing is to have this patch > on top of yours, so that err get, as before, set to -EINVAL when the > size is less than the perf_event_header sizeof: I'd think you need to squash your change with the original patch for the bisecting sake, right? > > diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c > index e89716175588..bad5f87ae001 100644 > --- a/tools/perf/util/session.c > +++ b/tools/perf/util/session.c > @@ -1928,6 +1928,8 @@ reader__process_events(struct reader *rd, struct perf_session *session, > > size = event->header.size; > > + skip = -EINVAL; > + > if (size < sizeof(struct perf_event_header) || > (skip = rd->process(session, event, file_pos)) < 0) { > pr_err("%#" PRIx64 " [%#x]: failed to process type: %d [%s]\n", > > --- > > With two Reviewed-by tags, I jumped to quickly at applying, please > compile test next time guys ;-) :-) ugh.. need to slow down, this is happening too often now :-\ jirka