lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Wed, 10 Nov 2021 09:09:56 +0100
From:   Greg KH <gregkh@...uxfoundation.org>
To:     cgel.zte@...il.com
Cc:     TheSven73@...il.com, linux-staging@...ts.linux.dev,
        linux-kernel@...r.kernel.org, Jing Yao <yao.jing2@....com.cn>,
        Zeal Robot <zealci@....com.cn>
Subject: Re: [PATCH] staging: fieldbus: Replace snprintf in show functions
 with  sysfs_emit

On Wed, Nov 10, 2021 at 02:30:48AM +0000, cgel.zte@...il.com wrote:
> From: Jing Yao <yao.jing2@....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@....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@....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

Powered by blists - more mailing lists