mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Li Huafei <lihuafei1@huawei.com>
To: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Cc: <namhyung@kernel.org>, <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>,
	<kan.liang@linux.intel.com>, <kjain@linux.ibm.com>,
	<sesse@google.com>, <linux-perf-users@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/3] perf disasm: Use disasm_line__free() to properly free disasm_line
Date: Sat, 19 Oct 2024 15:47:23 +0800	[thread overview]
Message-ID: <268c5c53-10c9-2c01-20d6-327e19184fed@huawei.com> (raw)
In-Reply-To: <90BD7422-B738-4A35-8D45-51212E17716C@linux.vnet.ibm.com>



On 2024/10/15 21:55, Athira Rajeev wrote:
> 
> 
>> On 14 Oct 2024, at 5:12 PM, Li Huafei <lihuafei1@huawei.com> wrote:
>>
>> The structure disasm_line contains members that require dynamically
>> allocated memory and need to be freed correctly using
>> disasm_line__free().
>>
>> This patch fixes the incorrect freeing in
>> symbol__disassemble_capstone_powerpc().  Also, since cs_disasm is not
>> enabled, it does not need to handle the situation described in
>> symbol__disassemble_capstone() where "offset != len" may occur due to
>> unknown instructions.
>>
>> Fixes: c5d60de1813a ("perf annotate: Add support to use libcapstone in powerpc")
>> Signed-off-by: Li Huafei <lihuafei1@huawei.com>
> 
> For the patches
> 
> Tested-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com <mailto:atrajeev@linux.vnet.ibm.com>>
> 

Thank you for the testing. As suggested by Namhyung in patch 3, the
patches need some modifications. I have sent v2, and if there are any
issues with v2, please let me know.

Thanks,
Huafei

> Thanks
> Athira
>> ---
>> tools/perf/util/disasm.c | 16 +---------------
>> 1 file changed, 1 insertion(+), 15 deletions(-)
>>
>> diff --git a/tools/perf/util/disasm.c b/tools/perf/util/disasm.c
>> index 42222d61ceb5..40d99f4d5cc7 100644
>> --- a/tools/perf/util/disasm.c
>> +++ b/tools/perf/util/disasm.c
>> @@ -1580,20 +1580,6 @@ static int symbol__disassemble_capstone_powerpc(char *filename, struct symbol *s
>> offset += 4;
>> }
>>
>> - /* It failed in the middle */
>> - if (offset != len) {
>> - struct list_head *list = &notes->src->source;
>> -
>> - /* Discard all lines and fallback to objdump */
>> - while (!list_empty(list)) {
>> - dl = list_first_entry(list, struct disasm_line, al.node);
>> -
>> - list_del_init(&dl->al.node);
>> - disasm_line__free(dl);
>> - }
>> - count = -1;
>> - }
>> -
>> out:
>> if (needs_cs_close)
>> cs_close(&handle);
>> @@ -1612,7 +1598,7 @@ static int symbol__disassemble_capstone_powerpc(char *filename, struct symbol *s
>> */
>> list_for_each_entry_safe(dl, tmp, &notes->src->source, al.node) {
>> list_del(&dl->al.node);
>> - free(dl);
>> + disasm_line__free(dl);
>> }
>> }
>> count = -1;
>> -- 
>> 2.25.1
>>
> 
> 
> .
> 

  reply	other threads:[~2024-10-19  7:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-14 11:42 [PATCH 1/3] " Li Huafei
2024-10-14 11:42 ` [PATCH 2/3] " Li Huafei
2024-10-15 13:55   ` Athira Rajeev
2024-10-19  7:47     ` Li Huafei [this message]
2024-10-14 11:42 ` [PATCH 3/3] perf disasm: Fix not cleaning up disasm_line in symbol__disassemble_raw() Li Huafei
2024-10-17 22:20   ` Namhyung Kim
2024-10-19  2:44     ` Li Huafei

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=268c5c53-10c9-2c01-20d6-327e19184fed@huawei.com \
    --to=lihuafei1@huawei.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=atrajeev@linux.vnet.ibm.com \
    --cc=irogers@google.com \
    --cc=jolsa@kernel.org \
    --cc=kan.liang@linux.intel.com \
    --cc=kjain@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=sesse@google.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

all inboxes | Powered by JetHome®