diff options
author | Tian Tao <[email protected]> | 2021-05-20 15:59:45 +0800 |
---|---|---|
committer | Will Deacon <[email protected]> | 2021-06-01 14:18:23 +0100 |
commit | a5740e955540181f4ab8f076cc9795c6bbe4d730 (patch) | |
tree | 3d735ba7d7c8ce378b6ca0b58f351ca42b246180 | |
parent | fdbef8c4e68ad423416aa6cc93d1616d6f8ac5b3 (diff) |
arm64: perf: Convert snprintf to sysfs_emit
Use sysfs_emit instead of snprintf to avoid buf overrun,because in
sysfs_emit it strictly checks whether buf is null or buf whether
pagesize aligned, otherwise it returns an error.
Signed-off-by: Tian Tao <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Will Deacon <[email protected]>
-rw-r--r-- | arch/arm64/kernel/perf_event.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/arm64/kernel/perf_event.c b/arch/arm64/kernel/perf_event.c index f594957e29bd..44b6eda69a81 100644 --- a/arch/arm64/kernel/perf_event.c +++ b/arch/arm64/kernel/perf_event.c @@ -312,7 +312,7 @@ static ssize_t slots_show(struct device *dev, struct device_attribute *attr, struct arm_pmu *cpu_pmu = container_of(pmu, struct arm_pmu, pmu); u32 slots = cpu_pmu->reg_pmmir & ARMV8_PMU_SLOTS_MASK; - return snprintf(page, PAGE_SIZE, "0x%08x\n", slots); + return sysfs_emit(page, "0x%08x\n", slots); } static DEVICE_ATTR_RO(slots); |