diff options
author | Artem Bityutskiy <artem.bityutskiy@linux.intel.com> | 2025-02-08 13:55:42 +0300 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2025-02-09 19:56:00 +0300 |
commit | 5132681dcd96b2a8c357b6e5d93e9876924bb80b (patch) | |
tree | ea1d924ed54d8f31fdf29785b336253310a0dac1 | |
parent | b312d880fb462d4759396950865ec914de9d253c (diff) | |
download | linux-5132681dcd96b2a8c357b6e5d93e9876924bb80b.tar.xz |
tools/power turbostat: Fix names matching
Fix the 'find_msrp_by_name()' function which returns incorrect matches for
cases like this:
s1 = "C1-";
find_msrp_by_name(head, s1);
Inside 'find_msrp_by_name()':
...
s2 = "C1"
if !(strcnmp(s1, s2, len(s2)))
// Incorrect match!
return mp;
Full strings should be match istead. Switch to 'strcmp()' to fix the problem.
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
-rw-r--r-- | tools/power/x86/turbostat/turbostat.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c index d26008f37a2c..d3af2bf307e1 100644 --- a/tools/power/x86/turbostat/turbostat.c +++ b/tools/power/x86/turbostat/turbostat.c @@ -9612,7 +9612,7 @@ struct msr_counter *find_msrp_by_name(struct msr_counter *head, char *name) for (mp = head; mp; mp = mp->next) { if (debug) fprintf(stderr, "%s: %s %s\n", __func__, name, mp->name); - if (!strncmp(name, mp->name, strlen(mp->name))) + if (!strcmp(name, mp->name)) return mp; } return NULL; |