linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: Yicong Yang <yangyicong@huawei.com>
Cc: peterz@infradead.org, mingo@redhat.com, acme@kernel.org,
	 mark.rutland@arm.com, alexander.shishkin@linux.intel.com,
	jolsa@kernel.org,  irogers@google.com, adrian.hunter@intel.com,
	linux-perf-users@vger.kernel.org,  linux-kernel@vger.kernel.org,
	jonathan.cameron@huawei.com,  hejunhao3@huawei.com,
	yangyicong@hisilicon.com, linuxarm@huawei.com
Subject: Re: [PATCH 2/2] perf hisi-ptt: Fix one memory leakage in hisi_ptt_process_auxtrace_event()
Date: Tue, 12 Dec 2023 17:20:18 -0800	[thread overview]
Message-ID: <CAM9d7cjmgFEXsHOfkryZRdypEdxb48JCrH-T70KYwsDXsZvWFg@mail.gmail.com> (raw)
In-Reply-To: <20231207081635.8427-3-yangyicong@huawei.com>

On Thu, Dec 7, 2023 at 12:20 AM Yicong Yang <yangyicong@huawei.com> wrote:
>
> From: Yicong Yang <yangyicong@hisilicon.com>
>
> ASan complains a memory leakage in hisi_ptt_process_auxtrace_event()
> that the data buffer is not freed. Since currently we only support
> the raw dump trace mode, the data buffer is used only within this
> function. So fix this by freeing the data buffer before going out.
>
> Fixes: 5e91e57e6809 ("perf auxtrace arm64: Add support for parsing HiSilicon PCIe Trace packet")
> Signed-off-by: Yicong Yang <yangyicong@hisilicon.com>

Acked-by: Namhyung Kim <Namhyung@kernel.org>

Thanks,
Namhyung

> ---
>  tools/perf/util/hisi-ptt.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/tools/perf/util/hisi-ptt.c b/tools/perf/util/hisi-ptt.c
> index 43bd1ca62d58..52d0ce302ca0 100644
> --- a/tools/perf/util/hisi-ptt.c
> +++ b/tools/perf/util/hisi-ptt.c
> @@ -123,6 +123,7 @@ static int hisi_ptt_process_auxtrace_event(struct perf_session *session,
>         if (dump_trace)
>                 hisi_ptt_dump_event(ptt, data, size);
>
> +       free(data);
>         return 0;
>  }
>
> --
> 2.24.0
>
>

  reply	other threads:[~2023-12-13  1:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-07  8:16 [PATCH 0/2] Perf fix two memory leakage Yicong Yang
2023-12-07  8:16 ` [PATCH 1/2] perf header: Fix one memory leakage in perf_event__fprintf_event_update() Yicong Yang
2023-12-13  1:17   ` Namhyung Kim
2023-12-07  8:16 ` [PATCH 2/2] perf hisi-ptt: Fix one memory leakage in hisi_ptt_process_auxtrace_event() Yicong Yang
2023-12-13  1:20   ` Namhyung Kim [this message]
2023-12-07 18:45 ` [PATCH 0/2] Perf fix two memory leakage Ian Rogers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAM9d7cjmgFEXsHOfkryZRdypEdxb48JCrH-T70KYwsDXsZvWFg@mail.gmail.com \
    --to=namhyung@kernel.org \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=hejunhao3@huawei.com \
    --cc=irogers@google.com \
    --cc=jolsa@kernel.org \
    --cc=jonathan.cameron@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=yangyicong@hisilicon.com \
    --cc=yangyicong@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).