mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-04-10 19:28:49 -04:00
perf pmu: Switch FILENAME_MAX to NAME_MAX
FILENAME_MAX is the same as PATH_MAX (4kb) in glibc rather than
NAME_MAX's 255. Switch to using NAME_MAX and ensure the '\0' is
accounted for in the path's buffer size.
Fixes: 754baf426e ("perf pmu: Change aliases from list to hashmap")
Signed-off-by: Ian Rogers <irogers@google.com>
Link: https://lore.kernel.org/r/20250717150855.1032526-2-irogers@google.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
This commit is contained in:
@@ -453,7 +453,7 @@ static struct perf_pmu_alias *perf_pmu__find_alias(struct perf_pmu *pmu,
|
||||
{
|
||||
struct perf_pmu_alias *alias;
|
||||
bool has_sysfs_event;
|
||||
char event_file_name[FILENAME_MAX + 8];
|
||||
char event_file_name[NAME_MAX + 8];
|
||||
|
||||
if (hashmap__find(pmu->aliases, name, &alias))
|
||||
return alias;
|
||||
@@ -752,7 +752,7 @@ static int pmu_aliases_parse(struct perf_pmu *pmu)
|
||||
|
||||
static int pmu_aliases_parse_eager(struct perf_pmu *pmu, int sysfs_fd)
|
||||
{
|
||||
char path[FILENAME_MAX + 7];
|
||||
char path[NAME_MAX + 8];
|
||||
int ret, events_dir_fd;
|
||||
|
||||
scnprintf(path, sizeof(path), "%s/events", pmu->name);
|
||||
|
||||
Reference in New Issue
Block a user