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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA7D4C25B08 for ; Wed, 10 Aug 2022 13:10:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232471AbiHJNKc (ORCPT ); Wed, 10 Aug 2022 09:10:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231687AbiHJNKc (ORCPT ); Wed, 10 Aug 2022 09:10:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EBBC4BEC; Wed, 10 Aug 2022 06:10:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 262176144B; Wed, 10 Aug 2022 13:10:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 67138C433D6; Wed, 10 Aug 2022 13:10:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1660137029; bh=sXSgjj5+4JsQMk/9Qox6+ZAQuvnEJ/J3+NWYzjJbhPE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ndzHzvgqRms/h4alSGbXbFmh+oce7SiBJ1vt6g2QWH1+sdnF7XALSFmJJE42VKRvx N/+HoxuaZosX9/dOFAD9C9bTOx5GePb8PDejMMGkOfWrGFu4o7yOAmOoe5SR0uGw4z MlnxKCbI1TCW32A5o0yb6QqlBkfyKHFG4Z5ey1olHRV53MslQojlf0mGJg183rjakm XAIetpwJvH2eLw1fJOtRjsa89n6jIXwrfxoV1M82Cbm+Zfx16SoSHWI2kVROBRwKwF tWqR4tdYaQenHKk1oKgCovH67wX3n1kSH7cGAsiqJwtBH3tF0UHpbJL2qARITQkDOH jKTxxEqleyWEw== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id 0877F4035A; Wed, 10 Aug 2022 10:10:27 -0300 (-03) Date: Wed, 10 Aug 2022 10:10:26 -0300 From: Arnaldo Carvalho de Melo To: Christophe JAILLET Cc: Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Masami Hiramatsu , linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Arnaldo Carvalho de Melo , linux-perf-users@vger.kernel.org Subject: Re: [PATCH v2] perf probe: Fix an error handling path in 'parse_perf_probe_command()' Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Url: http://acmel.wordpress.com Precedence: bulk List-ID: X-Mailing-List: linux-perf-users@vger.kernel.org Em Sat, Aug 06, 2022 at 04:51:26PM +0200, Christophe JAILLET escreveu: > If a memory allocation fail, we should branch to the error handling path in > order to free some resources allocated a few lines above. > > Fixes: 15354d546986 ("perf probe: Generate event name with line number") > Signed-off-by: Christophe JAILLET > Acked-by: Masami Hiramatsu Thanks, applied. - Arnaldo > --- > Change in v2: > - Synch with latest -next > - Add A-by tag (see link below, it was old!) > > v1: > https://lore.kernel.org/all/20200315201259.29190-1-christophe.jaillet@wanadoo.fr/ > --- > tools/perf/util/probe-event.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c > index 67c12d5303e7..785246ff4179 100644 > --- a/tools/perf/util/probe-event.c > +++ b/tools/perf/util/probe-event.c > @@ -1775,8 +1775,10 @@ int parse_perf_probe_command(const char *cmd, struct perf_probe_event *pev) > if (!pev->event && pev->point.function && pev->point.line > && !pev->point.lazy_line && !pev->point.offset) { > if (asprintf(&pev->event, "%s_L%d", pev->point.function, > - pev->point.line) < 0) > - return -ENOMEM; > + pev->point.line) < 0) { > + ret = -ENOMEM; > + goto out; > + } > } > > /* Copy arguments and ensure return probe has no C argument */ > -- > 2.34.1 -- - Arnaldo