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=-17.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 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 01703C433DB for ; Fri, 25 Dec 2020 02:28:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AF03D22C9D for ; Fri, 25 Dec 2020 02:28:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729117AbgLYC1t (ORCPT ); Thu, 24 Dec 2020 21:27:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726760AbgLYC1t (ORCPT ); Thu, 24 Dec 2020 21:27:49 -0500 Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D8C1CC061573 for ; Thu, 24 Dec 2020 18:27:08 -0800 (PST) Received: by mail-pl1-x62d.google.com with SMTP id e2so1954747plt.12 for ; Thu, 24 Dec 2020 18:27:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=ynNSSqVlh0E3n8/fKuki1zodJJQ4Lb7cgannL+ULGhk=; b=HL5YfDnLtIxawpuPb3V0m678jfhGmt6Kr5/GFnUq0C61uOtIHLcaXjtTdsMdc/ablZ wE24od1Zj0YcHUULKRCj/7ve9qLFpUIdmRNfB1wiUctq87ru6wx3zgvuu4EnXKoirovl 1PbXyb11L7hLkcEnhzjB/2LFEjZtI4ZsorPryIs+rz/rUVXSzYLp6ZKW2jpMc8DDvhvE CUfVXLR5B0MJPbYl5RjTduFoOpSTHI8oPz/86zce/vfQEd1yEFz2SCZ+ehw3IS3zZNzL 3g8KtiJyYatQJxBHaPe3YjLDo/LZ2WU7gsX3gTqFqkpDCRtpN2pROpdctuVB1bryR9Ce CWyg== 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:references :mime-version:content-disposition:in-reply-to:user-agent; bh=ynNSSqVlh0E3n8/fKuki1zodJJQ4Lb7cgannL+ULGhk=; b=iArhsNvHMw3JSUpIVmImBJ3Xrrx+VNoAQUOy1afDkOz7Qg8BNBW6f50aKj9a+IsW7d tr8Pas7hiRAkytlARXa4mcxEsDyHWHkcZ2kPIl3zQ1GkmlBHyJUD9C6c506SZpZkO8t3 HH41wUUUAkVJo1tZ8ITqtRhb9vvWOcBuqm9HJiF0AwXepi6/ZecpSmcPaDfDqwL/kGC+ kgO4aZ4H7//klWZG+7U6WLyMY1D6Kox03WjKv+AV50vls8shFRfCSm5tvLfSuD2Ha+TT c5M5Z3YUjWcWCX/SADTxph97ogWEcuDZDeLN8tQzin3OjaAdlrMW9WLvDkg3iv6cdnyX ExAg== X-Gm-Message-State: AOAM531yS48bI+l/GdZjGIc8cvxNqH/0SOn9jxwVcZvGiOCP8lZ9QwQM nwmyo9MfWyRBR4rhNHSpSDwfog== X-Google-Smtp-Source: ABdhPJyKDZMs13WVJx4IFtg4TITt8BbGv21vs65cpaz96LUxAl7lnog0CMvO62i6lahOndHpzprGjg== X-Received: by 2002:a17:902:b206:b029:dc:1f41:962d with SMTP id t6-20020a170902b206b02900dc1f41962dmr32664137plr.28.1608863227613; Thu, 24 Dec 2020 18:27:07 -0800 (PST) Received: from leoy-ThinkPad-X240s ([38.94.108.168]) by smtp.gmail.com with ESMTPSA id w6sm11749378pfq.208.2020.12.24.18.27.03 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 24 Dec 2020 18:27:06 -0800 (PST) Date: Fri, 25 Dec 2020 10:27:00 +0800 From: Leo Yan To: Arnaldo Carvalho de Melo Cc: Will Deacon , John Garry , Mathieu Poirier , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ian Rogers , Alexandre Truong , Masami Hiramatsu , He Zhe , Thomas Richter , Sumanth Korikkar , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v1 1/2] perf probe: Fixup Arm64 SDT arguments Message-ID: <20201225022700.GA22238@leoy-ThinkPad-X240s> References: <20201223063905.25784-1-leo.yan@linaro.org> <20201223063905.25784-2-leo.yan@linaro.org> <20201224135139.GF477817@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201224135139.GF477817@kernel.org> User-Agent: Mutt/1.9.4 (2018-02-28) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Dec 24, 2020 at 10:51:39AM -0300, Arnaldo Carvalho de Melo wrote: > Em Wed, Dec 23, 2020 at 02:39:04PM +0800, Leo Yan escreveu: > > Arm64 ELF section '.note.stapsdt' uses string format "-4@[sp, NUM]" if > > the probe is to access data in stack, e.g. below is an example for > > dumping Arm64 ELF file and shows the argument format: > > > > Arguments: -4@[sp, 12] -4@[sp, 8] -4@[sp, 4] > > > > Comparing against other archs' argument format, Arm64's argument > > introduces an extra space character in the middle of square brackets, > > due to argv_split() uses space as splitter, the argument is wrongly > > divided into two items. > > > > To support Arm64 SDT, this patch fixes up for this case, if any item > > contains sub string "[sp", concatenates the two continuous items. And > > adds the detailed explaination in comment. > > > > Signed-off-by: Leo Yan > > --- > > tools/perf/util/probe-file.c | 32 ++++++++++++++++++++++++++++++-- > > 1 file changed, 30 insertions(+), 2 deletions(-) > > > > diff --git a/tools/perf/util/probe-file.c b/tools/perf/util/probe-file.c > > index 064b63a6a3f3..60878c859e60 100644 > > --- a/tools/perf/util/probe-file.c > > +++ b/tools/perf/util/probe-file.c > > @@ -794,6 +794,8 @@ static char *synthesize_sdt_probe_command(struct sdt_note *note, > > char *ret = NULL, **args; > > int i, args_count, err; > > unsigned long long ref_ctr_offset; > > + char *arg; > > + int arg_idx = 0; > > > > if (strbuf_init(&buf, 32) < 0) > > return NULL; > > @@ -815,8 +817,34 @@ static char *synthesize_sdt_probe_command(struct sdt_note *note, > > if (note->args) { > > args = argv_split(note->args, &args_count); > > > > - for (i = 0; i < args_count; ++i) { > > - if (synthesize_sdt_probe_arg(&buf, i, args[i]) < 0) > > + for (i = 0; i < args_count; ) { > > + /* > > + * FIXUP: Arm64 ELF section '.note.stapsdt' uses string > > + * format "-4@[sp, NUM]" if a probe is to access data in > > + * the stack, e.g. below is an example for the SDT > > + * Arguments: > > + * > > + * Arguments: -4@[sp, 12] -4@[sp, 8] -4@[sp, 4] > > + * > > + * Since the string introduces an extra space character > > + * in the middle of square brackets, the argument is > > + * divided into two items. Fixup for this case, if an > > + * item contains sub string "[sp,", need to concatenate > > + * the two items. > > + */ > > + if (strstr(args[i], "[sp,") && (i+1) < args_count) { > > + arg = strcat(args[i], args[i+1]); > > + i += 2; > > + } else { > > + arg = strdup(args[i]); > > + i += 1; > > + } > > + > > + err = synthesize_sdt_probe_arg(&buf, arg_idx, arg); > > + free(arg); > > So you free here unconditionally because either you used something you > got from argv_split() that strdup'ed all the entries in the array it > returns, or that you strdup'ed in the else branch. > But then you may not free all the things argv_split() returned, right? Yes. > Also, that strcat(args[i], args[i+1]), are you sure that is safe? strcat > expects dest to have enough space for the concatenation, I don't see > argv_split[] adding extra bytes, just a strdup(). Correct, will change to use asprintf(). > So probably you need asprintf() where you use strcat() and then, at the > end of the loop, you need to free what argv_split() returned, using > argv_free(), no? > > Also please check strdup() (and then asprintf) managed to allocate, else > synthesize_sdt_probe_arg() will receive its 'desc' argument as NULL, do > _another_ strdup on it and boom. Will add checking for the pointer from strdup()/asprintf(). > Or am I missing something? :) > > I just looked ant synthesize_sdt_probe_command() is leaking the args it > gets from argv_split() > > So this patch is needed, ack? Below change is good for me. In the next respin, I will add this new patch with your author name and send out. Thanks a lot for the review, Masami & Arnaldo! > diff --git a/tools/perf/util/probe-file.c b/tools/perf/util/probe-file.c > index 064b63a6a3f311cd..bbecb449ea944395 100644 > --- a/tools/perf/util/probe-file.c > +++ b/tools/perf/util/probe-file.c > @@ -791,7 +791,7 @@ static char *synthesize_sdt_probe_command(struct sdt_note *note, > const char *sdtgrp) > { > struct strbuf buf; > - char *ret = NULL, **args; > + char *ret = NULL; > int i, args_count, err; > unsigned long long ref_ctr_offset; > > @@ -813,12 +813,19 @@ static char *synthesize_sdt_probe_command(struct sdt_note *note, > goto out; > > if (note->args) { > - args = argv_split(note->args, &args_count); > + char **args = argv_split(note->args, &args_count); > + > + if (args == NULL) > + goto error; > > for (i = 0; i < args_count; ++i) { > - if (synthesize_sdt_probe_arg(&buf, i, args[i]) < 0) > + if (synthesize_sdt_probe_arg(&buf, i, args[i]) < 0) { > + argv_free(args); > goto error; > + } > } > + > + argv_free(args); > } > > out: 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=-15.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=unavailable 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 F0708C433E0 for ; Fri, 25 Dec 2020 02:28:53 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A4E7C22C9D for ; Fri, 25 Dec 2020 02:28:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A4E7C22C9D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=VgHiCwOacDKop+Q10uXcV87lJ7WWwcI/yDXWnuLYbJU=; b=wIl5FEDy6QhrwLMpCKvwnipYU xT43gpWA0gwUnyVkWdnJuakvN+6APCnA7xh51CqrPAXvegbs/eKm+82Z/zlysVIQ07uxOGxxnxBxz rQ6DS/SghMfg3gz16M3Zij5lzHauiEDtoKh1DHy6HTtTg3zQFCn+qKk1u4CEhpbngGTEp+wdfE7eL Wl31qC1ILzlQR8lfTWcY9n40g6EbAJynhHvcgWgEtVoWI9tg+87PNE++CGqz4aOvyx2LAjcFzxIHd 9jbc0aAZEnXAcnryE9vGCeKCdJY3hg4bTWBmSz0xr5oX0Wx3Q+eKJh8zZJ34VOvsVzka419pICf8T QIv5F8QGw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kscp1-0001ob-6T; Fri, 25 Dec 2020 02:27:15 +0000 Received: from mail-pj1-x1029.google.com ([2607:f8b0:4864:20::1029]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kscox-0001no-RB for linux-arm-kernel@lists.infradead.org; Fri, 25 Dec 2020 02:27:13 +0000 Received: by mail-pj1-x1029.google.com with SMTP id b5so1980109pjk.2 for ; Thu, 24 Dec 2020 18:27:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=ynNSSqVlh0E3n8/fKuki1zodJJQ4Lb7cgannL+ULGhk=; b=HL5YfDnLtIxawpuPb3V0m678jfhGmt6Kr5/GFnUq0C61uOtIHLcaXjtTdsMdc/ablZ wE24od1Zj0YcHUULKRCj/7ve9qLFpUIdmRNfB1wiUctq87ru6wx3zgvuu4EnXKoirovl 1PbXyb11L7hLkcEnhzjB/2LFEjZtI4ZsorPryIs+rz/rUVXSzYLp6ZKW2jpMc8DDvhvE CUfVXLR5B0MJPbYl5RjTduFoOpSTHI8oPz/86zce/vfQEd1yEFz2SCZ+ehw3IS3zZNzL 3g8KtiJyYatQJxBHaPe3YjLDo/LZ2WU7gsX3gTqFqkpDCRtpN2pROpdctuVB1bryR9Ce CWyg== 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:references :mime-version:content-disposition:in-reply-to:user-agent; bh=ynNSSqVlh0E3n8/fKuki1zodJJQ4Lb7cgannL+ULGhk=; b=YKsHHleImyA8cd0uXjFbmPa3grGVBc58fLTOYEYFCDrOjbo2cP9khwQX37NOzywUs0 ph9eot8QPz0NmeXkNzIH2aUII3ek2mlkHqbVF6F2IpzH50OPJ8P/taNnBtsHp0Zv1nBJ aOwJoddE6tBnbjV+dJJrL2GLc4ilpQOow6l2+fXcTSX4eiy0rojP1C2a37Wauz2kl9KF emEeXwX2ff5wXTFFNOrWuYnJkg4DTEVCe8+Ekoc08Jm9IV0v6sj8kC0bmVDnV6+MtHWk PR9W7zZhpIxK7GVT3G4lj70nBX1T7cTdW9Th9yedvn8H2ff243PXt5lXiR3VPOqQ84l5 Xf8g== X-Gm-Message-State: AOAM533noBI3SqX37biNYKdycLqrYqaMnsb7EKEGBnJIm+qcEdi4eXmw euvu8YDDHLTYWMbe3ImfwV0U2w== X-Google-Smtp-Source: ABdhPJyKDZMs13WVJx4IFtg4TITt8BbGv21vs65cpaz96LUxAl7lnog0CMvO62i6lahOndHpzprGjg== X-Received: by 2002:a17:902:b206:b029:dc:1f41:962d with SMTP id t6-20020a170902b206b02900dc1f41962dmr32664137plr.28.1608863227613; Thu, 24 Dec 2020 18:27:07 -0800 (PST) Received: from leoy-ThinkPad-X240s ([38.94.108.168]) by smtp.gmail.com with ESMTPSA id w6sm11749378pfq.208.2020.12.24.18.27.03 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 24 Dec 2020 18:27:06 -0800 (PST) Date: Fri, 25 Dec 2020 10:27:00 +0800 From: Leo Yan To: Arnaldo Carvalho de Melo Subject: Re: [PATCH v1 1/2] perf probe: Fixup Arm64 SDT arguments Message-ID: <20201225022700.GA22238@leoy-ThinkPad-X240s> References: <20201223063905.25784-1-leo.yan@linaro.org> <20201223063905.25784-2-leo.yan@linaro.org> <20201224135139.GF477817@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20201224135139.GF477817@kernel.org> User-Agent: Mutt/1.9.4 (2018-02-28) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201224_212712_173062_B21FE2A8 X-CRM114-Status: GOOD ( 37.57 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Ian Rogers , He Zhe , Mathieu Poirier , Peter Zijlstra , Jiri Olsa , John Garry , linux-kernel@vger.kernel.org, Alexander Shishkin , Alexandre Truong , Ingo Molnar , Masami Hiramatsu , Namhyung Kim , Sumanth Korikkar , Will Deacon , linux-arm-kernel@lists.infradead.org, Thomas Richter Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Dec 24, 2020 at 10:51:39AM -0300, Arnaldo Carvalho de Melo wrote: > Em Wed, Dec 23, 2020 at 02:39:04PM +0800, Leo Yan escreveu: > > Arm64 ELF section '.note.stapsdt' uses string format "-4@[sp, NUM]" if > > the probe is to access data in stack, e.g. below is an example for > > dumping Arm64 ELF file and shows the argument format: > > > > Arguments: -4@[sp, 12] -4@[sp, 8] -4@[sp, 4] > > > > Comparing against other archs' argument format, Arm64's argument > > introduces an extra space character in the middle of square brackets, > > due to argv_split() uses space as splitter, the argument is wrongly > > divided into two items. > > > > To support Arm64 SDT, this patch fixes up for this case, if any item > > contains sub string "[sp", concatenates the two continuous items. And > > adds the detailed explaination in comment. > > > > Signed-off-by: Leo Yan > > --- > > tools/perf/util/probe-file.c | 32 ++++++++++++++++++++++++++++++-- > > 1 file changed, 30 insertions(+), 2 deletions(-) > > > > diff --git a/tools/perf/util/probe-file.c b/tools/perf/util/probe-file.c > > index 064b63a6a3f3..60878c859e60 100644 > > --- a/tools/perf/util/probe-file.c > > +++ b/tools/perf/util/probe-file.c > > @@ -794,6 +794,8 @@ static char *synthesize_sdt_probe_command(struct sdt_note *note, > > char *ret = NULL, **args; > > int i, args_count, err; > > unsigned long long ref_ctr_offset; > > + char *arg; > > + int arg_idx = 0; > > > > if (strbuf_init(&buf, 32) < 0) > > return NULL; > > @@ -815,8 +817,34 @@ static char *synthesize_sdt_probe_command(struct sdt_note *note, > > if (note->args) { > > args = argv_split(note->args, &args_count); > > > > - for (i = 0; i < args_count; ++i) { > > - if (synthesize_sdt_probe_arg(&buf, i, args[i]) < 0) > > + for (i = 0; i < args_count; ) { > > + /* > > + * FIXUP: Arm64 ELF section '.note.stapsdt' uses string > > + * format "-4@[sp, NUM]" if a probe is to access data in > > + * the stack, e.g. below is an example for the SDT > > + * Arguments: > > + * > > + * Arguments: -4@[sp, 12] -4@[sp, 8] -4@[sp, 4] > > + * > > + * Since the string introduces an extra space character > > + * in the middle of square brackets, the argument is > > + * divided into two items. Fixup for this case, if an > > + * item contains sub string "[sp,", need to concatenate > > + * the two items. > > + */ > > + if (strstr(args[i], "[sp,") && (i+1) < args_count) { > > + arg = strcat(args[i], args[i+1]); > > + i += 2; > > + } else { > > + arg = strdup(args[i]); > > + i += 1; > > + } > > + > > + err = synthesize_sdt_probe_arg(&buf, arg_idx, arg); > > + free(arg); > > So you free here unconditionally because either you used something you > got from argv_split() that strdup'ed all the entries in the array it > returns, or that you strdup'ed in the else branch. > But then you may not free all the things argv_split() returned, right? Yes. > Also, that strcat(args[i], args[i+1]), are you sure that is safe? strcat > expects dest to have enough space for the concatenation, I don't see > argv_split[] adding extra bytes, just a strdup(). Correct, will change to use asprintf(). > So probably you need asprintf() where you use strcat() and then, at the > end of the loop, you need to free what argv_split() returned, using > argv_free(), no? > > Also please check strdup() (and then asprintf) managed to allocate, else > synthesize_sdt_probe_arg() will receive its 'desc' argument as NULL, do > _another_ strdup on it and boom. Will add checking for the pointer from strdup()/asprintf(). > Or am I missing something? :) > > I just looked ant synthesize_sdt_probe_command() is leaking the args it > gets from argv_split() > > So this patch is needed, ack? Below change is good for me. In the next respin, I will add this new patch with your author name and send out. Thanks a lot for the review, Masami & Arnaldo! > diff --git a/tools/perf/util/probe-file.c b/tools/perf/util/probe-file.c > index 064b63a6a3f311cd..bbecb449ea944395 100644 > --- a/tools/perf/util/probe-file.c > +++ b/tools/perf/util/probe-file.c > @@ -791,7 +791,7 @@ static char *synthesize_sdt_probe_command(struct sdt_note *note, > const char *sdtgrp) > { > struct strbuf buf; > - char *ret = NULL, **args; > + char *ret = NULL; > int i, args_count, err; > unsigned long long ref_ctr_offset; > > @@ -813,12 +813,19 @@ static char *synthesize_sdt_probe_command(struct sdt_note *note, > goto out; > > if (note->args) { > - args = argv_split(note->args, &args_count); > + char **args = argv_split(note->args, &args_count); > + > + if (args == NULL) > + goto error; > > for (i = 0; i < args_count; ++i) { > - if (synthesize_sdt_probe_arg(&buf, i, args[i]) < 0) > + if (synthesize_sdt_probe_arg(&buf, i, args[i]) < 0) { > + argv_free(args); > goto error; > + } > } > + > + argv_free(args); > } > > out: _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel