From: Alex Elder <elder@ieee.org>
To: ye.xingchen@zte.com.cn, davem@davemloft.net
Cc: elder@kernel.org, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] net: ipa: use sysfs_emit() to instead of scnprintf()
Date: Fri, 2 Dec 2022 16:20:16 -0600 [thread overview]
Message-ID: <ff01f296-f3bb-4fdf-d57f-8dd14f1b61d2@ieee.org> (raw)
In-Reply-To: <202212021642142044742@zte.com.cn>
On 12/2/22 2:42 AM, ye.xingchen@zte.com.cn wrote:
> From: ye xingchen <ye.xingchen@zte.com.cn>
>
> Follow the advice of the Documentation/filesystems/sysfs.rst and show()
> should only use sysfs_emit() or sysfs_emit_at() when formatting the
> value to be returned to user space.
The buffer passed is non-null and the existing code properly
limits the buffer to PAGE_SIZE.
But... OK.
Reviewed-by: Alex Elder <elder@linaro.org>
>
> Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn>
> ---
> drivers/net/ipa/ipa_sysfs.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/ipa/ipa_sysfs.c b/drivers/net/ipa/ipa_sysfs.c
> index 5cbc15a971f9..14bd2f903045 100644
> --- a/drivers/net/ipa/ipa_sysfs.c
> +++ b/drivers/net/ipa/ipa_sysfs.c
> @@ -46,7 +46,7 @@ version_show(struct device *dev, struct device_attribute *attr, char *buf)
> {
> struct ipa *ipa = dev_get_drvdata(dev);
>
> - return scnprintf(buf, PAGE_SIZE, "%s\n", ipa_version_string(ipa));
> + return sysfs_emit(buf, "%s\n", ipa_version_string(ipa));
> }
>
> static DEVICE_ATTR_RO(version);
> @@ -70,7 +70,7 @@ static ssize_t rx_offload_show(struct device *dev,
> {
> struct ipa *ipa = dev_get_drvdata(dev);
>
> - return scnprintf(buf, PAGE_SIZE, "%s\n", ipa_offload_string(ipa));
> + return sysfs_emit(buf, "%s\n", ipa_offload_string(ipa));
> }
>
> static DEVICE_ATTR_RO(rx_offload);
> @@ -80,7 +80,7 @@ static ssize_t tx_offload_show(struct device *dev,
> {
> struct ipa *ipa = dev_get_drvdata(dev);
>
> - return scnprintf(buf, PAGE_SIZE, "%s\n", ipa_offload_string(ipa));
> + return sysfs_emit(buf, "%s\n", ipa_offload_string(ipa));
> }
>
> static DEVICE_ATTR_RO(tx_offload);
next prev parent reply other threads:[~2022-12-02 22:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-02 8:42 ye.xingchen
2022-12-02 22:20 ` Alex Elder [this message]
2022-12-07 2:53 ` Jakub Kicinski
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=ff01f296-f3bb-4fdf-d57f-8dd14f1b61d2@ieee.org \
--to=elder@ieee.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=elder@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=ye.xingchen@zte.com.cn \
/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
all inboxes | Powered by JetHome®