From: Shuah Khan <skhan@linuxfoundation.org>
To: Jules Irenge <jbi.octave@gmail.com>,
shuah@kernel.org, gregkh@linuxfoundation.org
Cc: valentina.manea.m@gmail.com, linux-usb@vger.kernel.org,
Shuah Khan <skhan@linuxfoundation.org>
Subject: Re: [PATCH] usbip: vudc: Convert snprintf() to sysfs_emit()
Date: Mon, 3 Oct 2022 11:19:23 -0600 [thread overview]
Message-ID: <f01c0f9c-3a9d-074d-6e63-c04514a43812@linuxfoundation.org> (raw)
In-Reply-To: <YzhVIaNGdM33pcts@octinomon>
On 10/1/22 08:56, Jules Irenge wrote:
> Coccinnelle reports a warning
> Warning: Use scnprintf or sprintf
>
> Following the advice on kernel documentation
> https://www.kernel.org/doc/html/latest/filesystems/sysfs.html
>
> For show(device *...) functions we should only use sysfs_emit() or sysfs_emit_at()
> especially when formatting the value to be returned to user space.
> Convert snprintf() to sysfs_emit()
>
> Signed-off-by: Jules Irenge <jules.irenge@postgrad.manchester.ac.uk>
> ---
> drivers/usb/usbip/vudc_sysfs.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/usb/usbip/vudc_sysfs.c b/drivers/usb/usbip/vudc_sysfs.c
> index c95e6b2bfd32..907a43a00896 100644
> --- a/drivers/usb/usbip/vudc_sysfs.c
> +++ b/drivers/usb/usbip/vudc_sysfs.c
> @@ -242,7 +242,7 @@ static ssize_t usbip_status_show(struct device *dev,
> status = udc->ud.status;
> spin_unlock_irq(&udc->ud.lock);
>
> - return snprintf(out, PAGE_SIZE, "%d\n", status);
> + return sysfs_emit(out, "%d\n", status);
> }
> static DEVICE_ATTR_RO(usbip_status);
>
Looks good to me.
Reviewed-by: Shuah Khan <skhan@linuxfoundation.org>
Greg, Please pick this up.
thanks,
-- Shuah
prev parent reply other threads:[~2022-10-03 17:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-01 14:56 [PATCH] usbip: vudc: Convert snprintf() to sysfs_emit() Jules Irenge
2022-10-03 17:19 ` Shuah Khan [this message]
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=f01c0f9c-3a9d-074d-6e63-c04514a43812@linuxfoundation.org \
--to=skhan@linuxfoundation.org \
--cc=gregkh@linuxfoundation.org \
--cc=jbi.octave@gmail.com \
--cc=linux-usb@vger.kernel.org \
--cc=shuah@kernel.org \
--cc=valentina.manea.m@gmail.com \
/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