From: Siddharth Gupta <sidgup@codeaurora.org>
To: ohad@wizery.com, bjorn.andersson@linaro.org,
linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Raghavendra Rao Ananta <rananta@codeaurora.org>,
Siddharth Gupta <sidgup@codeaurora.org>
Subject: [PATCH] remoteproc: sysfs: Use scnprintf instead of sprintf
Date: Wed, 3 Mar 2021 12:01:38 -0800 [thread overview]
Message-ID: <1614801698-25987-1-git-send-email-sidgup@codeaurora.org> (raw)
From: Raghavendra Rao Ananta <rananta@codeaurora.org>
For security reasons scnprintf() is preferred over sprintf().
Hence, convert the remoteproc's sysfs show functions accordingly.
Signed-off-by: Raghavendra Rao Ananta <rananta@codeaurora.org>
Signed-off-by: Siddharth Gupta <sidgup@codeaurora.org>
---
drivers/remoteproc/remoteproc_sysfs.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/remoteproc/remoteproc_sysfs.c b/drivers/remoteproc/remoteproc_sysfs.c
index 1dbef89..853f569 100644
--- a/drivers/remoteproc/remoteproc_sysfs.c
+++ b/drivers/remoteproc/remoteproc_sysfs.c
@@ -15,7 +15,8 @@ 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 scnprintf(buf, PAGE_SIZE, "%s",
+ rproc->recovery_disabled ? "disabled\n" : "enabled\n");
}
/*
@@ -82,7 +83,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 scnprintf(buf, PAGE_SIZE, "%s\n", rproc_coredump_str[rproc->dump_conf]);
}
/*
--
Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
next reply other threads:[~2021-03-04 0:01 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-03 20:01 Siddharth Gupta [this message]
2021-03-03 20:56 ` [PATCH] remoteproc: sysfs: Use scnprintf instead of sprintf Bjorn Andersson
2021-03-03 21:38 ` Siddharth Gupta
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1614801698-25987-1-git-send-email-sidgup@codeaurora.org \
--to=sidgup@codeaurora.org \
--cc=bjorn.andersson@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-remoteproc@vger.kernel.org \
--cc=ohad@wizery.com \
--cc=rananta@codeaurora.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).