mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: cgel.zte@gmail.com
Cc: TheSven73@gmail.com, linux-staging@lists.linux.dev,
	linux-kernel@vger.kernel.org, Jing Yao <yao.jing2@zte.com.cn>,
	Zeal Robot <zealci@zte.com.cn>
Subject: Re: [PATCH] staging: fieldbus: Replace snprintf in show functions with  sysfs_emit
Date: Wed, 10 Nov 2021 09:09:56 +0100	[thread overview]
Message-ID: <YYt+VPc5Uc6qeT3p@kroah.com> (raw)
In-Reply-To: <20211110023048.135535-1-yao.jing2@zte.com.cn>

On Wed, Nov 10, 2021 at 02:30:48AM +0000, cgel.zte@gmail.com wrote:
> From: Jing Yao <yao.jing2@zte.com.cn>
> 
> coccicheck complains about the use of snprintf() in sysfs show
> functions:
> WARNING use scnprintf or sprintf
> 
> Use sysfs_emit instead of scnprintf, snprintf or sprintf makes more
> sense.
> 
> Reported-by: Zeal Robot <zealci@zte.com.cn>

But coccicheck is the thing that is reporting this, right?

And your subject line has two space characters between "with" and
"sysfs_emit" for some odd reason :(


> Signed-off-by: Jing Yao <yao.jing2@zte.com.cn>
> ---
>  drivers/staging/fieldbus/dev_core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/fieldbus/dev_core.c b/drivers/staging/fieldbus/dev_core.c
> index 5aab734606ea..01862fe8e4cc 100644
> --- a/drivers/staging/fieldbus/dev_core.c
> +++ b/drivers/staging/fieldbus/dev_core.c
> @@ -70,7 +70,7 @@ static ssize_t card_name_show(struct device *dev, struct device_attribute *attr,
>  	 * card_name was provided by child driver, could potentially be long.
>  	 * protect against buffer overrun.
>  	 */
> -	return snprintf(buf, PAGE_SIZE, "%s\n", fb->card_name);
> +	return sysfs_emit(buf, "%s\n", fb->card_name);
>  }
>  static DEVICE_ATTR_RO(card_name);


Your "bot" is not very good, why are you only changing one function in
this file and not all of the places where sysfs_emit() could be used?

Doing this one function at a time is really hard, please do not do it
that way.

thanks,

greg k-h

      reply	other threads:[~2021-11-10  8:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-10  2:30 cgel.zte
2021-11-10  8:09 ` 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=YYt+VPc5Uc6qeT3p@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=TheSven73@gmail.com \
    --cc=cgel.zte@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=yao.jing2@zte.com.cn \
    --cc=zealci@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

Powered by JetHome