[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b471c336-92dc-af42-dfd2-62831fd6dd60@oracle.com>
Date: Wed, 2 Aug 2023 10:43:56 +0100
From: John Garry <john.g.garry@...cle.com>
To: Jing Zhang <renyu.zj@...ux.alibaba.com>
Cc: Ian Rogers <irogers@...gle.com>, Will Deacon <will@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Robin Murphy <robin.murphy@....com>,
Ilkka Koskinen <ilkka@...amperecomputing.com>,
Namhyung Kim <namhyung@...nel.org>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-perf-users@...r.kernel.org, linux-doc@...r.kernel.org,
Zhuo Song <zhuo.song@...ux.alibaba.com>,
Shuai Xue <xueshuai@...ux.alibaba.com>
Subject: Re: [PATCH v5 1/5] perf metric: Event "Compat" value supports
matching multiple identifiers
On 02/08/2023 10:38, Jing Zhang wrote:
>>>> n;
>>>> +
>>>> + str = strdup(compat);
>>> why duplicate this? are you modifying something?
>>>
>> This is really a redundant step, I will remove it.
>>
> Hi John,
>
> I reviewed this code again and found that it still needs to duplicate "compat" because "compat" is a
> const str* type and cannot be used as a parameter for the strtok_r function. If it is cast to char*,
> using "compat" as a parameter for strtok_r is also unsafe and can cause a "Segmentation fault" error.
> Therefore, let's keep the step of duplicating "compat".
ok, so then please add a small comment on why the strdup() call is needed.
Thanks,
John
Powered by blists - more mailing lists