projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
a0b2f5a
)
perf pmu: Fix check for unset alias->unit array
author
Arnaldo Carvalho de Melo
<
[email protected]
>
Wed, 15 Feb 2017 13:06:20 +0000
(10:06 -0300)
committer
Arnaldo Carvalho de Melo
<
[email protected]
>
Wed, 15 Feb 2017 13:06:20 +0000
(10:06 -0300)
The alias->unit field is an array, so to check that it is not set we
should see if it is an empty string, i.e. alias->unit[0], instead of
checking alias->unit != NULL, as this will _always_ evaluate to 'true'.
Pointed out by clang.
Acked-by: Jiri Olsa <
[email protected]
>
Cc: Adrian Hunter <
[email protected]
>
Cc: David Ahern <
[email protected]
>
Cc: Namhyung Kim <
[email protected]
>
Cc: Wang Nan <
[email protected]
>
Link:
http://lkml.kernel.org/r/
[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <
[email protected]
>
tools/perf/util/pmu.c
patch
|
blob
|
history
diff --git
a/tools/perf/util/pmu.c
b/tools/perf/util/pmu.c
index 82a654dec6662b1ba635b3217c31af048c815f91..49bfee0e3d9ed0b483180a74b7bfd96954f4968b 100644
(file)
--- a/
tools/perf/util/pmu.c
+++ b/
tools/perf/util/pmu.c
@@
-945,12
+945,12
@@
static int check_info_data(struct perf_pmu_alias *alias,
* define unit, scale and snapshot, fail
* if there's more than one.
*/
- if ((info->unit && alias->unit) ||
+ if ((info->unit && alias->unit
[0]
) ||
(info->scale && alias->scale) ||
(info->snapshot && alias->snapshot))
return -EINVAL;
- if (alias->unit)
+ if (alias->unit
[0]
)
info->unit = alias->unit;
if (alias->scale)