diff options
| author | Sumeet Pawnikar <sumeet4linux@gmail.com> | 2025-12-07 18:15:48 +0300 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2026-01-17 18:30:01 +0300 |
| commit | c04b3a832c06240ec2abaab02836e5d87a232513 (patch) | |
| tree | 543d38ba3b789e7010ee32320ae8c0868abce4b7 /tools/perf/scripts/python/stackcollapse.py | |
| parent | e07dea55aa13435d048ee4bc7ee2d02c4491b47e (diff) | |
| download | linux-c04b3a832c06240ec2abaab02836e5d87a232513.tar.xz | |
powercap: fix sscanf() error return value handling
[ Upstream commit efc4c35b741af973de90f6826bf35d3b3ac36bf1 ]
Fix inconsistent error handling for sscanf() return value check.
Implicit boolean conversion is used instead of explicit return
value checks. The code checks if (!sscanf(...)) which is incorrect
because:
1. sscanf returns the number of successfully parsed items
2. On success, it returns 1 (one item passed)
3. On failure, it returns 0 or EOF
4. The check 'if (!sscanf(...))' is wrong because it treats
success (1) as failure
All occurrences of sscanf() now uses explicit return value check.
With this behavior it returns '-EINVAL' when parsing fails (returns
0 or EOF), and continues when parsing succeeds (returns 1).
Signed-off-by: Sumeet Pawnikar <sumeet4linux@gmail.com>
[ rjw: Subject and changelog edits ]
Link: https://patch.msgid.link/20251207151549.202452-1-sumeet4linux@gmail.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'tools/perf/scripts/python/stackcollapse.py')
0 files changed, 0 insertions, 0 deletions
