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: <85eefbd5-bc90-4cb8-807f-6d1ee195e7f4@infradead.org>
Date: Mon, 21 Oct 2024 17:49:49 +0900
From: Geoff Levand <geoff@...radead.org>
To: Paulo Miguel Almeida <paulo.miguel.almeida.rodenas@...il.com>,
 mpe@...erman.id.au, npiggin@...il.com, christophe.leroy@...roup.eu,
 naveen@...nel.org, maddy@...ux.ibm.com, linuxppc-dev@...ts.ozlabs.org,
 linux-kernel@...r.kernel.org
Cc: linux-hardening@...r.kernel.org
Subject: Re: [PATCH][next] powerpc/ps3: replace open-coded sysfs_emit function

Hi Paulo,

On 10/19/24 11:13, Paulo Miguel Almeida wrote:
> sysfs_emit() helper function should be used when formatting the value
> to be returned to user space.
> 
> This patch replaces open-coded sysfs_emit() in sysfs .show() callbacks
> 
> Link: https://github.com/KSPP/linux/issues/105
> Signed-off-by: Paulo Miguel Almeida <paulo.miguel.almeida.rodenas@...il.com>
> ---
>  arch/powerpc/platforms/ps3/system-bus.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/powerpc/platforms/ps3/system-bus.c b/arch/powerpc/platforms/ps3/system-bus.c
> index b9a7d9bae687..afbaabf182d0 100644
> --- a/arch/powerpc/platforms/ps3/system-bus.c
> +++ b/arch/powerpc/platforms/ps3/system-bus.c
> @@ -453,10 +453,9 @@ static ssize_t modalias_show(struct device *_dev, struct device_attribute *a,
>  	char *buf)
>  {
>  	struct ps3_system_bus_device *dev = ps3_dev_to_system_bus_dev(_dev);
> -	int len = snprintf(buf, PAGE_SIZE, "ps3:%d:%d\n", dev->match_id,
> -			   dev->match_sub_id);
>  
> -	return (len >= PAGE_SIZE) ? (PAGE_SIZE - 1) : len;
> +	return sysfs_emit(buf, "ps3:%d:%d\n", dev->match_id,
> +			  dev->match_sub_id);
>  }
>  static DEVICE_ATTR_RO(modalias);

I tested this on PS3 and it seems to work OK.
Thanks for your contribution.

Acked-by: Geoff Levand <geoff@...radead.org>



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ