All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: greybus: gbphy: use sysfs_emit() instead of sprintf()
@ 2026-08-08 17:13 Mohit Mishra
  2026-09-01  9:48 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 2+ messages in thread
From: Mohit Mishra @ 2026-08-08 17:13 UTC (permalink / raw)
  To: Johan Hovold, Alex Elder, Greg Kroah-Hartman
  Cc: greybus-dev, linux-staging, linux-kernel, Mohit Mishra

protocol_id_show() uses sprintf() to format sysfs output into the page
buffer. Convert it to sysfs_emit(), which is the preferred helper for
sysfs show() callbacks as it enforces page boundary checks.

Similar conversions have already been made elsewhere in this subsystem
(e.g. loopback.c, arche-platform.c).

Signed-off-by: Mohit Mishra <mishraloopmohit@gmail.com>
---
 drivers/staging/greybus/gbphy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/greybus/gbphy.c b/drivers/staging/greybus/gbphy.c
index bdb0f5164a6f..bb9a5b538e6e 100644
--- a/drivers/staging/greybus/gbphy.c
+++ b/drivers/staging/greybus/gbphy.c
@@ -31,7 +31,7 @@ static ssize_t protocol_id_show(struct device *dev,
 {
 	struct gbphy_device *gbphy_dev = to_gbphy_dev(dev);
 
-	return sprintf(buf, "0x%02x\n", gbphy_dev->cport_desc->protocol_id);
+	return sysfs_emit(buf, "0x%02x\n", gbphy_dev->cport_desc->protocol_id);
 }
 static DEVICE_ATTR_RO(protocol_id);
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] staging: greybus: gbphy: use sysfs_emit() instead of sprintf()
  2026-08-08 17:13 [PATCH] staging: greybus: gbphy: use sysfs_emit() instead of sprintf() Mohit Mishra
@ 2026-09-01  9:48 ` Greg Kroah-Hartman
  0 siblings, 0 replies; 2+ messages in thread
From: Greg Kroah-Hartman @ 2026-09-01  9:48 UTC (permalink / raw)
  To: Mohit Mishra
  Cc: Johan Hovold, Alex Elder, greybus-dev, linux-staging,
	linux-kernel

On Sat, Aug 08, 2026 at 10:43:02PM +0530, Mohit Mishra wrote:
> protocol_id_show() uses sprintf() to format sysfs output into the page
> buffer. Convert it to sysfs_emit(), which is the preferred helper for
> sysfs show() callbacks as it enforces page boundary checks.
> 
> Similar conversions have already been made elsewhere in this subsystem
> (e.g. loopback.c, arche-platform.c).
> 
> Signed-off-by: Mohit Mishra <mishraloopmohit@gmail.com>
> ---
>  drivers/staging/greybus/gbphy.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/greybus/gbphy.c b/drivers/staging/greybus/gbphy.c
> index bdb0f5164a6f..bb9a5b538e6e 100644
> --- a/drivers/staging/greybus/gbphy.c
> +++ b/drivers/staging/greybus/gbphy.c
> @@ -31,7 +31,7 @@ static ssize_t protocol_id_show(struct device *dev,
>  {
>  	struct gbphy_device *gbphy_dev = to_gbphy_dev(dev);
>  
> -	return sprintf(buf, "0x%02x\n", gbphy_dev->cport_desc->protocol_id);
> +	return sysfs_emit(buf, "0x%02x\n", gbphy_dev->cport_desc->protocol_id);
>  }
>  static DEVICE_ATTR_RO(protocol_id);
>  
> -- 
> 2.43.0
> 

Please see the mailing list archives for why this type of patch keeps
getting rejected.

sorry,

greg k-h

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-09-01  9:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-08 17:13 [PATCH] staging: greybus: gbphy: use sysfs_emit() instead of sprintf() Mohit Mishra
2026-09-01  9:48 ` Greg Kroah-Hartman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.