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]
Message-ID: <CAJnrk1aGA35Fwh=GfT5SVG9KhycK4X821CNa7=-pd9qJLM7x4w@mail.gmail.com>
Date: Mon, 15 Dec 2025 13:06:38 +0900
From: Joanne Koong <joannelkoong@...il.com>
To: chen zhang <chenzhang@...inos.cn>
Cc: miklos@...redi.hu, mszeredi@...hat.com, josef@...icpanda.com, 
	linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org, 
	chenzhang_0901@....com
Subject: Re: [PATCH] fuse: use sysfs_emit() instead of sprintf()

On Mon, Dec 15, 2025 at 10:44 AM chen zhang <chenzhang@...inos.cn> wrote:
>
> 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.

I think it'd be useful here to include why too (eg that it handles the
page-sized buffer limit and prevents potential buffer overflow)

>
> Signed-off-by: chen zhang <chenzhang@...inos.cn>

nit: the convention (at least as far as I can tell :)) is for
signed-off-by names to be capitalized

> ---
>  fs/fuse/cuse.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/fuse/cuse.c b/fs/fuse/cuse.c
> index 28c96961e85d..0c8e7259f489 100644
> --- a/fs/fuse/cuse.c
> +++ b/fs/fuse/cuse.c
> @@ -581,7 +581,7 @@ static ssize_t cuse_class_waiting_show(struct device *dev,
>  {
>         struct cuse_conn *cc = dev_get_drvdata(dev);
>
> -       return sprintf(buf, "%d\n", atomic_read(&cc->fc.num_waiting));
> +       return sysfs_emit(buf, "%d\n", atomic_read(&cc->fc.num_waiting));
>  }
>  static DEVICE_ATTR(waiting, 0400, cuse_class_waiting_show, NULL);

Reviewed-by: Joanne Koong <joannelkoong@...il.com>

btw, cpu_list_show() in fuse/virtio_fs.c could be converted to use
sysfs_emit_at() as well.

Thanks,
Joanne
>
> --
> 2.25.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ