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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <88cfa1e8-3e1f-4670-a8b5-0066079fc29a@molgen.mpg.de>
Date: Fri, 22 Nov 2024 13:39:15 +0100
From: Paul Menzel <pmenzel@...gen.mpg.de>
To: zhangheng@...inos.cn
Cc: marcel@...tmann.org, johan.hedberg@...il.com, luiz.dentz@...il.com,
 erick.archer@...look.com, kees@...nel.org, geert@...ux-m68k.org,
 jirislaby@...nel.org, linux-bluetooth@...r.kernel.org,
 linux-kernel@...r.kernel.org
Subject: Re: [PATCH] tty: rfcomm: use sysfs_emit() instead of sprintf()

Dear Zhangheng,


Thank you for your patch.

Am 22.11.24 um 12:19 schrieb zhangheng:
> Follow the advice in Documentation/filesystems/sysfs.rst:
> show() should only use sysfs_emit() or sysfs_emit_at() when formatting
> the value to be returned to user space.
> 
> Signed-off-by: zhangheng <zhangheng@...inos.cn>

Is zhangheng the official spelling of your name? If not, please update.

> ---
>   net/bluetooth/rfcomm/tty.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c
> index af80d599c337..21a5b5535ebc 100644
> --- a/net/bluetooth/rfcomm/tty.c
> +++ b/net/bluetooth/rfcomm/tty.c
> @@ -201,14 +201,14 @@ static ssize_t address_show(struct device *tty_dev,
>   			    struct device_attribute *attr, char *buf)
>   {
>   	struct rfcomm_dev *dev = dev_get_drvdata(tty_dev);
> -	return sprintf(buf, "%pMR\n", &dev->dst);
> +	return sysfs_emit(buf, "%pMR\n", &dev->dst);
>   }
>   
>   static ssize_t channel_show(struct device *tty_dev,
>   			    struct device_attribute *attr, char *buf)
>   {
>   	struct rfcomm_dev *dev = dev_get_drvdata(tty_dev);
> -	return sprintf(buf, "%d\n", dev->channel);
> +	return sysfs_emit(buf, "%d\n", dev->channel);
>   }
>   
>   static DEVICE_ATTR_RO(address);


Kind regards,

Paul

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ