Thread (21 messages) read the whole thread 21 messages, 2 authors, 2023-08-02

Re: [PATCH v5 1/5] perf metric: Event "Compat" value supports matching multiple identifiers

From: John Garry <john.g.garry@oracle.com>
Date: 2023-08-02 09:44:26
Also in: linux-doc, linux-perf-users, lkml

On 02/08/2023 10:38, Jing Zhang wrote:
quoted
quoted
quoted
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

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help