All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] perf/core: convert snprintf to scnprintf
@ 2022-09-17 23:41 Jules Irenge
  2022-09-19 11:25 ` Peter Zijlstra
  0 siblings, 1 reply; 2+ messages in thread
From: Jules Irenge @ 2022-09-17 23:41 UTC (permalink / raw)
  To: peterz
  Cc: mingo, acme, mark.rutland, jolsa, namhyung, linux-perf-users,
	Elana.Copperman

Coccinelle reports a warning

WARNING: use scnprintf or sprintf

Adding to that,
there has also been some slow migration from snprintf to scnprintf
The article explains the rationale for this change

https: //lwn.net/Articles/69419/
Signed-off-by: Jules Irenge <jbi.octave@gmail.com>
---
 kernel/events/core.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/events/core.c b/kernel/events/core.c
index 2621fd24ad26..0b03a98945eb 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -10933,7 +10933,7 @@ static ssize_t nr_addr_filters_show(struct device *dev,
 {
 	struct pmu *pmu = dev_get_drvdata(dev);
 
-	return snprintf(page, PAGE_SIZE - 1, "%d\n", pmu->nr_addr_filters);
+	return scnprintf(page, PAGE_SIZE - 1, "%d\n", pmu->nr_addr_filters);
 }
 DEVICE_ATTR_RO(nr_addr_filters);
 
@@ -10944,7 +10944,7 @@ type_show(struct device *dev, struct device_attribute *attr, char *page)
 {
 	struct pmu *pmu = dev_get_drvdata(dev);
 
-	return snprintf(page, PAGE_SIZE-1, "%d\n", pmu->type);
+	return scnprintf(page, PAGE_SIZE - 1, "%d\n", pmu->type);
 }
 static DEVICE_ATTR_RO(type);
 
@@ -10955,7 +10955,7 @@ perf_event_mux_interval_ms_show(struct device *dev,
 {
 	struct pmu *pmu = dev_get_drvdata(dev);
 
-	return snprintf(page, PAGE_SIZE-1, "%d\n", pmu->hrtimer_interval_ms);
+	return scnprintf(page, PAGE_SIZE - 1, "%d\n", pmu->hrtimer_interval_ms);
 }
 
 static DEFINE_MUTEX(mux_interval_mutex);
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/2] perf/core: convert snprintf to scnprintf
  2022-09-17 23:41 [PATCH 1/2] perf/core: convert snprintf to scnprintf Jules Irenge
@ 2022-09-19 11:25 ` Peter Zijlstra
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Zijlstra @ 2022-09-19 11:25 UTC (permalink / raw)
  To: Jules Irenge
  Cc: mingo, acme, mark.rutland, jolsa, namhyung, linux-perf-users,
	Elana.Copperman

On Sun, Sep 18, 2022 at 12:41:08AM +0100, Jules Irenge wrote:
> Coccinelle reports a warning
> 
> WARNING: use scnprintf or sprintf
> 
> Adding to that,
> there has also been some slow migration from snprintf to scnprintf
> The article explains the rationale for this change
> 
> https: //lwn.net/Articles/69419/

Please but at least a bare minimum of justification in the Changelog
itself. I can't be arsed to wade through the interweb in order to figure
out if this patch has merit or is just whitespace wankery.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-09-19 11:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-17 23:41 [PATCH 1/2] perf/core: convert snprintf to scnprintf Jules Irenge
2022-09-19 11:25 ` Peter Zijlstra

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.