Skip to content

Commit 5132681

Browse files
dedekindlenb
authored andcommitted
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>
1 parent b312d88 commit 5132681

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tools/power/x86/turbostat/turbostat.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9612,7 +9612,7 @@ struct msr_counter *find_msrp_by_name(struct msr_counter *head, char *name)
96129612
for (mp = head; mp; mp = mp->next) {
96139613
if (debug)
96149614
fprintf(stderr, "%s: %s %s\n", __func__, name, mp->name);
9615-
if (!strncmp(name, mp->name, strlen(mp->name)))
9615+
if (!strcmp(name, mp->name))
96169616
return mp;
96179617
}
96189618
return NULL;

0 commit comments

Comments
 (0)