Skip to content

Commit 66285c6

Browse files
committed
perf pmu: Switch FILENAME_MAX to NAME_MAX
JIRA: https://issues.redhat.com/browse/RHEL-78198 upstream ======== commit 82aac55 Author: Ian Rogers <irogers@google.com> Date: Thu Jul 17 08:08:54 2025 -0700 description =========== 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: 754baf4 ("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> Signed-off-by: Michael Petlan <mpetlan@redhat.com>
1 parent 3e34104 commit 66285c6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tools/perf/util/pmu.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ static struct perf_pmu_alias *perf_pmu__find_alias(struct perf_pmu *pmu,
452452
{
453453
struct perf_pmu_alias *alias;
454454
bool has_sysfs_event;
455-
char event_file_name[FILENAME_MAX + 8];
455+
char event_file_name[NAME_MAX + 8];
456456

457457
if (hashmap__find(pmu->aliases, name, &alias))
458458
return alias;
@@ -751,7 +751,7 @@ static int pmu_aliases_parse(struct perf_pmu *pmu)
751751

752752
static int pmu_aliases_parse_eager(struct perf_pmu *pmu, int sysfs_fd)
753753
{
754-
char path[FILENAME_MAX + 7];
754+
char path[NAME_MAX + 8];
755755
int ret, events_dir_fd;
756756

757757
scnprintf(path, sizeof(path), "%s/events", pmu->name);

0 commit comments

Comments
 (0)