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: <617e83e9-c9ad-45d1-bc5a-eba2ecd7965f@csgroup.eu>
Date: Mon, 22 Sep 2025 16:58:21 +0200
From: Christophe Leroy <christophe.leroy@...roup.eu>
To: Chelsy Ratnawat <chelsyratnawat2001@...il.com>, ioana.ciornei@....com
Cc: linuxppc-dev@...ts.ozlabs.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] bus: fsl-mc: Replace snprintf and sprintf with
 sysfs_emit in sysfs show functions



Le 22/08/2025 à 14:43, Chelsy Ratnawat a écrit :
> [Vous ne recevez pas souvent de courriers de chelsyratnawat2001@...il.com. Découvrez pourquoi ceci est important à https://aka.ms/LearnAboutSenderIdentification ]
> 
> Use sysfs_emit() instead of snprintf()/sprintf()  when writing
> to sysfs buffers, as recommended by the kernel documentation.
> 
> Signed-off-by: Chelsy Ratnawat <chelsyratnawat2001@...il.com>
> ---
> Changes in v2:
>   - replace sprintf() with sysfs_emit() in modalias_show()
>   - change commit msg to include the change for sprintf
> 
>   drivers/bus/fsl-mc/fsl-mc-bus.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/bus/fsl-mc/fsl-mc-bus.c b/drivers/bus/fsl-mc/fsl-mc-bus.c
> index c1c0a4759c7e..88fea34a55b9 100644
> --- a/drivers/bus/fsl-mc/fsl-mc-bus.c
> +++ b/drivers/bus/fsl-mc/fsl-mc-bus.c
> @@ -176,8 +176,8 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
>   {
>          struct fsl_mc_device *mc_dev = to_fsl_mc_device(dev);
> 
> -       return sprintf(buf, "fsl-mc:v%08Xd%s\n", mc_dev->obj_desc.vendor,
> -                      mc_dev->obj_desc.type);
> +       return sysfs_emit(buf, "fsl-mc:v%08Xd%s\n", mc_dev->obj_desc.vendor,
> +                       mc_dev->obj_desc.type);
>   }
>   static DEVICE_ATTR_RO(modalias);
> 
> @@ -203,7 +203,7 @@ static ssize_t driver_override_show(struct device *dev,
>   {
>          struct fsl_mc_device *mc_dev = to_fsl_mc_device(dev);
> 
> -       return snprintf(buf, PAGE_SIZE, "%s\n", mc_dev->driver_override);
> +       return sysfs_emit(buf, "%s\n", mc_dev->driver_override);
>   }
>   static DEVICE_ATTR_RW(driver_override);
> 
> --
> 2.47.3
> 
> 

Applied, thanks!

Christophe

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ