diff options
| author | Ian Rogers <[email protected]> | 2023-09-07 21:05:33 +0000 |
|---|---|---|
| committer | Namhyung Kim <[email protected]> | 2023-10-12 17:01:55 +0000 |
| commit | 03ff4c6b3e41b3530c6c88cc91a7af599322eb89 (patch) | |
| tree | 912b28c5416ada05985a92721378211fb5ef6aaf /scripts/clang-tools/gen_compile_commands.py | |
| parent | Merge tag 'perf-tools-fixes-for-v6.6-1-2023-09-25' into perf-tools-next (diff) | |
| download | kernel-03ff4c6b3e41b3530c6c88cc91a7af599322eb89.tar.gz kernel-03ff4c6b3e41b3530c6c88cc91a7af599322eb89.zip | |
perf parse-events: Avoid erange from hex numbers
We specify that a "num_hex" comprises 1 or more digits, however, that
allows strtoull to fail with ERANGE. Limit the number of hex digits to
being between 1 and 16.
Before:
```
$ perf stat -e 'cpu/rE7574c47490475745/' true
perf: util/parse-events.c:215: fix_raw: Assertion `errno == 0' failed.
Aborted (core dumped)
```
After:
```
$ perf stat -e 'cpu/rE7574c47490475745/' true
event syntax error: 'cpu/rE7574c47490475745/'
\___ Bad event or PMU
Unable to find PMU or event on a PMU of 'cpu'
Initial error:
event syntax error: 'cpu/rE7574c47490475745/'
\___ unknown term 'rE7574c47490475745' for pmu 'cpu'
valid terms: event,pc,edge,offcore_rsp,ldlat,inv,umask,frontend,cmask,config,config1,config2,config3,name,period,percore,metric-id
Run 'perf list' for a list of valid events
Usage: perf stat [<options>] [<command>]
-e, --event <event> event selector. use 'perf list' to list available events
```
Issue found through fuzz testing.
Signed-off-by: Ian Rogers <[email protected]>
Acked-by: Namhyung Kim <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Namhyung Kim <[email protected]>
Diffstat (limited to 'scripts/clang-tools/gen_compile_commands.py')
0 files changed, 0 insertions, 0 deletions
