diff options
| author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2026-06-07 22:38:26 -0300 |
|---|---|---|
| committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2026-06-10 18:56:01 -0300 |
| commit | 1847c5fae344a0fb9cc0f95be40b378359c6fc3b (patch) | |
| tree | c7690524adcdfa696ed4df06a2374a8e2c0e4249 /Documentation/gpu/intel-display/git@git.tavy.me:linux.git | |
| parent | 31d596054550f793508abe7dd593853ece47d428 (diff) | |
perf hwmon: Fix off-by-one null termination on sysfs reads
Three functions read sysfs files into fixed-size stack buffers using
the full buffer size, then null-terminate at buf[read_len]. If the
read fills the buffer exactly, read_len equals sizeof(buf) and the
null byte writes one past the array, corrupting an adjacent stack
variable.
Fix all three by reading sizeof(buf) - 1 bytes, reserving space for
the null terminator:
- hwmon_pmu__read_events(): buf[128]
- hwmon_pmu__describe_items(): buf[64]
- evsel__hwmon_pmu_read(): buf[32]
Fixes: 53cc0b351ec99278 ("perf hwmon_pmu: Add a tool PMU exposing events from hwmon in sysfs")
Reported-by: sashiko-bot <sashiko-bot@kernel.org>
Cc: Ian Rogers <irogers@google.com>
Assisted-by: Claude:claude-opus-4.6
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'Documentation/gpu/intel-display/git@git.tavy.me:linux.git')
0 files changed, 0 insertions, 0 deletions
