Skip to contentSkip to conversation

remoteproc: sysfs: Use sysfs_emit instead of sprintf

PATCH Applied Siddharth Gupta 2 participants 2 messages Mar 4, 2021 – Mar 11, 2021 Remote processor (remoteproc)

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 remoteproc: sysfs: Use sysfs_emit instead of sprintf

From: Raghavendra Rao Ananta <[email protected]>

For security reasons sysfs_emit() is preferred over sprintf(). Hence, convert the remoteproc's sysfs show functions accordingly.

---
 drivers/remoteproc/remoteproc_sysfs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/remoteproc/remoteproc_sysfs.c +2 -2
index 1dbef89..6840dad 100644
@@ -15,7 +15,7 @@ static ssize_t recovery_show(struct device *dev,
 {
 	struct rproc *rproc = to_rproc(dev);
 
-	return sprintf(buf, "%s", rproc->recovery_disabled ? "disabled\n" : "enabled\n");
+	return sysfs_emit(buf, "%s", rproc->recovery_disabled ? "disabled\n" : "enabled\n");
 }
 
 /*
@@ -82,7 +82,7 @@ static ssize_t coredump_show(struct device *dev,
 {
 	struct rproc *rproc = to_rproc(dev);
 
-	return sprintf(buf, "%s\n", rproc_coredump_str[rproc->dump_conf]);
+	return sysfs_emit(buf, "%s\n", rproc_coredump_str[rproc->dump_conf]);
 }
 
 /*
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
#1 lore raw
This patch was applied to andersson/remoteproc.git (refs/heads/for-next):

Hello:

This patch was applied to andersson/remoteproc.git (refs/heads/for-next):

Quoted 9 lines · On Wed, 3 Mar 2021 13:47:02 -0800 you wrote:

From: Raghavendra Rao Ananta <[email protected]>

For security reasons sysfs_emit() is preferred over sprintf(). Hence, convert the remoteproc's sysfs show functions accordingly.

[...]

Here is the summary with links:
- [v2] remoteproc: sysfs: Use sysfs_emit instead of sprintf

    https://git.kernel.org/andersson/remoteproc/c/145e1da374bc

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html