diff options
author | Steven Rostedt (Google) <[email protected]> | 2024-03-13 09:34:54 -0400 |
---|---|---|
committer | Steven Rostedt (Google) <[email protected]> | 2024-03-18 10:25:40 -0400 |
commit | 3f9952e8d80cca2da3b47ecd5ad9ec16cfd1a649 (patch) | |
tree | 26a6a80ab684546853473194a4a68c000bacb742 /tools/perf/util/trace-event-scripting.c | |
parent | 0df4c388a1e310400a6e90fb10b286e2673756f0 (diff) |
net: hns3: tracing: fix hclgevf trace event strings
The __string() and __assign_str() helper macros of the TRACE_EVENT() macro
are going through some optimizations where only the source string of
__string() will be used and the __assign_str() source will be ignored and
later removed.
To make sure that there's no issues, a new check is added between the
__string() src argument and the __assign_str() src argument that does a
strcmp() to make sure they are the same string.
The hclgevf trace events have:
__assign_str(devname, &hdev->nic.kinfo.netdev->name);
Which triggers the warning:
hclgevf_trace.h:34:39: error: passing argument 1 of ‘strcmp’ from incompatible pointer type [-Werror=incompatible-pointer-types]
34 | __assign_str(devname, &hdev->nic.kinfo.netdev->name);
[..]
arch/x86/include/asm/string_64.h:75:24: note: expected ‘const char *’ but argument is of type ‘char (*)[16]’
75 | int strcmp(const char *cs, const char *ct);
| ~~~~~~~~~~~~^~
Because __assign_str() now has:
WARN_ON_ONCE(__builtin_constant_p(src) ? \
strcmp((src), __data_offsets.dst##_ptr_) : \
(src) != __data_offsets.dst##_ptr_); \
The problem is the '&' on hdev->nic.kinfo.netdev->name. That's because
that name is:
char name[IFNAMSIZ]
Where passing an address '&' of a char array is not compatible with strcmp().
The '&' is not necessary, remove it.
Link: https://lore.kernel.org/linux-trace-kernel/[email protected]
Cc: netdev <[email protected]>
Cc: Yisen Zhuang <[email protected]>
Cc: Salil Mehta <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Eric Dumazet <[email protected]>
Cc: Jakub Kicinski <[email protected]>
Cc: Yufeng Mo <[email protected]>
Cc: Huazhong Tan <[email protected]>
Cc: [email protected]
Acked-by: Paolo Abeni <[email protected]>
Reviewed-by: Jijie Shao <[email protected]>
Fixes: d8355240cf8fb ("net: hns3: add trace event support for PF/VF mailbox")
Signed-off-by: Steven Rostedt (Google) <[email protected]>
Diffstat (limited to 'tools/perf/util/trace-event-scripting.c')
0 files changed, 0 insertions, 0 deletions