The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Tomas Winkler <tomas.winkler@intel.com>
Cc: Alexander Usyskin <alexander.usyskin@intel.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [char-misc-next 1/6] mei: use sprintf in tx_queue_limit_show sysfs
Date: Sat, 6 Feb 2021 15:46:44 +0100	[thread overview]
Message-ID: <YB6r1HcHjEQpseaM@kroah.com> (raw)
In-Reply-To: <20210206144325.25682-1-tomas.winkler@intel.com>

On Sat, Feb 06, 2021 at 04:43:20PM +0200, Tomas Winkler wrote:
> Using of snprintf is discouraged in sysfs.
> For simple u8 it is safe to use sprintf.
> 
> Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
> ---
>  drivers/misc/mei/main.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/misc/mei/main.c b/drivers/misc/mei/main.c
> index 9f6682033ed7..24a05f45b639 100644
> --- a/drivers/misc/mei/main.c
> +++ b/drivers/misc/mei/main.c
> @@ -1026,7 +1026,7 @@ static ssize_t tx_queue_limit_show(struct device *device,
>  	size = dev->tx_queue_limit;
>  	mutex_unlock(&dev->device_lock);
>  
> -	return snprintf(buf, PAGE_SIZE, "%u\n", size);
> +	return sprintf(buf, "%u\n", size);

If you are going to do this, why not just convert it to use sysfs_emit()
instead?

thanks,

greg k-h

  parent reply	other threads:[~2021-02-06 14:47 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-06 14:43 [char-misc-next 1/6] mei: use sprintf in tx_queue_limit_show sysfs Tomas Winkler
2021-02-06 14:43 ` [char-misc-next 2/6] mei: allow clients on bus to communicate in remove callback Tomas Winkler
2021-02-06 14:43 ` [char-misc-next 3/6] mei: add support for client dma capability Tomas Winkler
2021-02-06 14:43 ` [char-misc-next 4/6] mei: hbm: add client dma hbm messages Tomas Winkler
2021-02-06 14:43 ` [char-misc-next 5/6] mei: implement client dma setup Tomas Winkler
2021-02-06 14:43 ` [char-misc-next 6/6] mei: bus: add client dma interface Tomas Winkler
2021-02-06 14:48   ` Greg Kroah-Hartman
2021-02-06 15:04     ` Winkler, Tomas
2021-02-06 16:30       ` Greg Kroah-Hartman
2021-02-07 14:03         ` Winkler, Tomas
2021-02-07 14:33           ` Greg Kroah-Hartman
2021-02-07 19:04             ` Grumbach, Emmanuel
2021-02-06 14:46 ` Greg Kroah-Hartman [this message]
2021-02-06 14:58   ` [char-misc-next 1/6] mei: use sprintf in tx_queue_limit_show sysfs Winkler, Tomas

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=YB6r1HcHjEQpseaM@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=alexander.usyskin@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tomas.winkler@intel.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