From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F3FEDC433B4 for ; Thu, 15 Apr 2021 12:42:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C6996611AC for ; Thu, 15 Apr 2021 12:42:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232988AbhDOMnM (ORCPT ); Thu, 15 Apr 2021 08:43:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:52224 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232993AbhDOMnK (ORCPT ); Thu, 15 Apr 2021 08:43:10 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 75B88610E8; Thu, 15 Apr 2021 12:42:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1618490567; bh=3M573xfs0hNXfcCF4OhMwhysBCpFoK9x2zhcPMH6MCE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=rhibKjm+E0PTHJnnjSg49QkkkTHu4PodN1IM//rzWAFkVF16V4LsZudMr8F9m73Fr K8PKDiOYBfmp6aXurI7V5oe4Y/kaosCZswDnj51KwjKtJpG/OYTnglASt/irGE177S khD1g/6sm4uPAHnDcj4GTFw4BeZ8scOkVw/J97ECOuTI6SzEJ+eHE3/w8U1kcuUYJ5 EpkUlsGpkGFK5I2EYSBQzJfKtNQKAQMlSnLd5s38LuINBESudy3S57jfCKPeJrjtsp z6tjrHrB4VJTmHRrnz6M84Umsp1rtRCBL/40w3KJDBrk6rGYHXLzL4DoBFA9lPIhBO NBMjfLckfNINw== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id 138E040647; Thu, 15 Apr 2021 09:42:44 -0300 (-03) Date: Thu, 15 Apr 2021 09:42:43 -0300 From: Arnaldo Carvalho de Melo To: Zhen Lei , Jiri Olsa Cc: Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , linux-kernel Subject: Re: [PATCH 1/1] perf map: Fix error return code in maps__clone() Message-ID: References: <20210415092744.3793-1-thunder.leizhen@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210415092744.3793-1-thunder.leizhen@huawei.com> X-Url: http://acmel.wordpress.com Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Thu, Apr 15, 2021 at 05:27:44PM +0800, Zhen Lei escreveu: > Although 'err' has been initialized to -ENOMEM, but it will be reassigned > by the "err = unwind__prepare_access(...)" statement in the for loop. So > that, the value of 'err' is unknown when map__clone() failed. You forgot to research and add this: Fixes: 6c502584438bda63 ("perf unwind: Call unwind__prepare_access for forked thread") So that the stable@kernel.org guys can pick this up automagically and apply this fix to the stable kernels. I've added it. Thanks, applied. - Arnaldo > Reported-by: Hulk Robot > Signed-off-by: Zhen Lei > --- > tools/perf/util/map.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c > index fbc40a2c17d4dca..8af693d9678cefe 100644 > --- a/tools/perf/util/map.c > +++ b/tools/perf/util/map.c > @@ -840,15 +840,18 @@ int maps__fixup_overlappings(struct maps *maps, struct map *map, FILE *fp) > int maps__clone(struct thread *thread, struct maps *parent) > { > struct maps *maps = thread->maps; > - int err = -ENOMEM; > + int err; > struct map *map; > > down_read(&parent->lock); > > maps__for_each_entry(parent, map) { > struct map *new = map__clone(map); > - if (new == NULL) > + > + if (new == NULL) { > + err = -ENOMEM; > goto out_unlock; > + } > > err = unwind__prepare_access(maps, new, NULL); > if (err) > -- > 2.26.0.106.g9fadedd > > -- - Arnaldo