public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
Cc: jirislaby@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] vt: convert sysfs sprintf/snprintf family to sysfs_emit
Date: Mon, 22 Feb 2021 09:53:40 +0100	[thread overview]
Message-ID: <YDNxFGx3bHCBoZVd@kroah.com> (raw)
In-Reply-To: <1613983729-101495-1-git-send-email-jiapeng.chong@linux.alibaba.com>

On Mon, Feb 22, 2021 at 04:48:49PM +0800, Jiapeng Chong wrote:
> Fix the following coccicheck warning:
> 
> ./drivers/tty/vt/vt.c:3909:8-16: WARNING: use scnprintf or sprintf.
> ./drivers/tty/vt/vt.c:3917:8-16: WARNING: use scnprintf or sprintf

Why?

You say what you did, but there is no justification for why this is
required in the tree.

> 
> Reported-by: Abaci Robot<abaci@linux.alibaba.com>

You forgot a ' '.

> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
> ---
>  drivers/tty/vt/vt.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
> index 284b072..cdf8132 100644
> --- a/drivers/tty/vt/vt.c
> +++ b/drivers/tty/vt/vt.c
> @@ -3906,7 +3906,7 @@ static ssize_t show_bind(struct device *dev, struct device_attribute *attr,
>  	bind = con_is_bound(con->con);
>  	console_unlock();
>  
> -	return snprintf(buf, PAGE_SIZE, "%i\n", bind);
> +	return sysfs_emit(buf, "%i\n", bind);
>  }
>  
>  static ssize_t show_name(struct device *dev, struct device_attribute *attr,
> @@ -3914,9 +3914,8 @@ static ssize_t show_name(struct device *dev, struct device_attribute *attr,
>  {
>  	struct con_driver *con = dev_get_drvdata(dev);
>  
> -	return snprintf(buf, PAGE_SIZE, "%s %s\n",
> -			(con->flag & CON_DRIVER_FLAG_MODULE) ? "(M)" : "(S)",
> -			 con->desc);
> +	return sysfs_emit(buf, "%s %s\n", (con->flag & CON_DRIVER_FLAG_MODULE) ? "(M)" : "(S)",
> +			  con->desc);

Why make the line longer now?  Can't this be a 1 line change here?

And why is this needed?

thanks,

greg k-h

      reply	other threads:[~2021-02-22  8:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-22  8:48 [PATCH] vt: convert sysfs sprintf/snprintf family to sysfs_emit Jiapeng Chong
2021-02-22  8:53 ` Greg KH [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=YDNxFGx3bHCBoZVd@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=jiapeng.chong@linux.alibaba.com \
    --cc=jirislaby@kernel.org \
    --cc=linux-kernel@vger.kernel.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