All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: fieldbus: Use sysfs_emit for show(device *...) functions
@ 2020-10-18 18:26 Deepak R Varma
  2020-10-23 13:40 ` Sven Van Asbroeck
  0 siblings, 1 reply; 3+ messages in thread
From: Deepak R Varma @ 2020-10-18 18:26 UTC (permalink / raw)
  To: outreachy-kernel, Sven Van Asbroeck, Greg Kroah-Hartman; +Cc: mh12gx2825

Convert snprintf calls in device show functions to sysfs_emit for
PAGE_SIZE buffer safety.
Warning generated by: scripts/coccinelle/api/device_attr_show.cocci

Signed-off-by: Deepak R Varma <mh12gx2825@gmail.com>
---
 drivers/staging/fieldbus/dev_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/fieldbus/dev_core.c b/drivers/staging/fieldbus/dev_core.c
index 1ba0234cc60d..698d7b479270 100644
--- a/drivers/staging/fieldbus/dev_core.c
+++ b/drivers/staging/fieldbus/dev_core.c
@@ -70,7 +70,7 @@ static ssize_t card_name_show(struct device *dev, struct device_attribute *attr,
 	 * card_name was provided by child driver, could potentially be long.
 	 * protect against buffer overrun.
 	 */
-	return snprintf(buf, PAGE_SIZE, "%s\n", fb->card_name);
+	return sysfs_emit(buf, "%s\n", fb->card_name);
 }
 static DEVICE_ATTR_RO(card_name);
 
-- 
2.25.1



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

end of thread, other threads:[~2020-11-02 20:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-18 18:26 [PATCH] staging: fieldbus: Use sysfs_emit for show(device *...) functions Deepak R Varma
2020-10-23 13:40 ` Sven Van Asbroeck
2020-11-02 20:28   ` Deepak R Varma

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.