projects
/
platform
/
kernel
/
linux-starfive.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
fdbef8c
)
arm64: perf: Convert snprintf to sysfs_emit
author
Tian Tao
<tiantao6@hisilicon.com>
Thu, 20 May 2021 07:59:45 +0000
(15:59 +0800)
committer
Will Deacon
<will@kernel.org>
Tue, 1 Jun 2021 13:18:23 +0000
(14:18 +0100)
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 <tiantao6@hisilicon.com>
Link:
https://lore.kernel.org/r/1621497585-30887-1-git-send-email-tiantao6@hisilicon.com
Signed-off-by: Will Deacon <will@kernel.org>
arch/arm64/kernel/perf_event.c
patch
|
blob
|
history
diff --git
a/arch/arm64/kernel/perf_event.c
b/arch/arm64/kernel/perf_event.c
index f594957e29bd1253fdfae7fdd8df6742033c122b..44b6eda69a81aea6d93cc26f6045cbe9926f6d4e 100644
(file)
--- 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 s
nprintf(page, PAGE_SIZE
, "0x%08x\n", slots);
+ return s
ysfs_emit(page
, "0x%08x\n", slots);
}
static DEVICE_ATTR_RO(slots);