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: <aH4c-bAN28Gmq86k@sumit-X1>
Date: Mon, 21 Jul 2025 16:26:57 +0530
From: Sumit Garg <sumit.garg@...nel.org>
To: Akhilesh Patil <akhilesh@...iitb.ac.in>
Cc: jens.wiklander@...aro.org, op-tee@...ts.trustedfirmware.org,
	linux-kernel@...r.kernel.org, akhileshpatilvnit@...il.com,
	skhan@...uxfoundation.org
Subject: Re: [PATCH] drivers: tee: improve sysfs interface by using
 sysfs_emit()

On Fri, Jul 18, 2025 at 09:00:13PM +0530, Akhilesh Patil wrote:
> Replace scnprintf() with sysfs_emit() while formatting buffer that is
> passed to userspace as per the recommendation in
> Documentation/filesystems/sysfs.rst. sysfs _show() callbacks should use
> sysfs_emit() or sysfs_emit_at() while returning values to the userspace.
> This change does not impact functionality, but aligns with sysfs
> interface usage guidelines for the tee driver.
> 
> Signed-off-by: Akhilesh Patil <akhilesh@...iitb.ac.in>
> ---
>  drivers/tee/optee/core.c | 2 +-
>  drivers/tee/tee_core.c   | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)

Nice catch.

Reviewed-by: Sumit Garg <sumit.garg@....qualcomm.com>

-Sumit

> 
> diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c
> index c75fddc83576..ce44e3498d37 100644
> --- a/drivers/tee/optee/core.c
> +++ b/drivers/tee/optee/core.c
> @@ -72,7 +72,7 @@ static ssize_t rpmb_routing_model_show(struct device *dev,
>  	else
>  		s = "user";
>  
> -	return scnprintf(buf, PAGE_SIZE, "%s\n", s);
> +	return sysfs_emit(buf, "%s\n", s);
>  }
>  static DEVICE_ATTR_RO(rpmb_routing_model);
>  
> diff --git a/drivers/tee/tee_core.c b/drivers/tee/tee_core.c
> index acc7998758ad..944f913f8592 100644
> --- a/drivers/tee/tee_core.c
> +++ b/drivers/tee/tee_core.c
> @@ -977,7 +977,7 @@ static ssize_t implementation_id_show(struct device *dev,
>  	struct tee_ioctl_version_data vers;
>  
>  	teedev->desc->ops->get_version(teedev, &vers);
> -	return scnprintf(buf, PAGE_SIZE, "%d\n", vers.impl_id);
> +	return sysfs_emit(buf, "%d\n", vers.impl_id);
>  }
>  static DEVICE_ATTR_RO(implementation_id);
>  
> -- 
> 2.34.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ