Linux Input/HID development
 help / color / mirror / Atom feed
From: Nehuen Lian Bova <nehuenlian.kernel@gmail.com>
To: jikos@kernel.org, bentiss@kernel.org
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
	Nehuen Lian Bova <nehuenlian.kernel@gmail.com>
Subject: [PATCH] HID: wacom: replace sprintf calls with sysfs_emit calls in wacom_sys.c
Date: Sat, 31 Oct 2026 22:14:39 -0300	[thread overview]
Message-ID: <20261101011439.261812-1-nehuenlian.kernel@gmail.com> (raw)

Replace 'sprintf' calls with safer 'sysfs_emit' calls in wacom_sys.c, also
include the header '<linux/sysfs.h>'. No functional changes.

Signed-off-by: Nehuen Lian Bova <nehuenlian.kernel@gmail.com>
---
 drivers/hid/wacom_sys.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c
index 628372ab818a..bb51ea4b34f8 100644
--- a/drivers/hid/wacom_sys.c
+++ b/drivers/hid/wacom_sys.c
@@ -6,6 +6,7 @@
 #include "wacom_wac.h"
 #include "wacom.h"
 #include <linux/input/mt.h>
+#include <linux/sysfs.h>
 
 #define WAC_MSG_RETRIES		5
 #define WAC_CMD_RETRIES		10
@@ -1838,7 +1839,7 @@ static int __wacom_initialize_battery(struct wacom *wacom,
 	bat_desc->properties = wacom_battery_props;
 	bat_desc->num_properties = ARRAY_SIZE(wacom_battery_props);
 	bat_desc->get_property = wacom_battery_get_property;
-	sprintf(battery->bat_name, "wacom_battery_%ld", n);
+	sysfs_emit(battery->bat_name, "wacom_battery_%ld", n);
 	bat_desc->name = battery->bat_name;
 	bat_desc->type = POWER_SUPPLY_TYPE_BATTERY;
 	bat_desc->use_for_apm = 0;
@@ -1928,7 +1929,7 @@ static ssize_t wacom_show_remote_mode(struct kobject *kobj,
 	u8 mode;
 
 	mode = wacom->led.groups[index].select;
-	return sprintf(buf, "%d\n", mode < 3 ? mode : -1);
+	return sysfs_emit(buf, "%d\n", mode < 3 ? mode : -1);
 }
 
 #define DEVICE_EKR_ATTR_GROUP(SET_ID)					\
-- 
2.43.0


             reply	other threads:[~2026-11-01  1:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-01  1:14 Nehuen Lian Bova [this message]
2026-11-01  1:19 ` [PATCH] HID: wacom: replace sprintf calls with sysfs_emit calls in wacom_sys.c sashiko-bot
2026-11-01  5:48 ` [PATCH v2] HID: wacom: replace sprintf calls with safer alternatives Nehuen Lian Bova
2026-11-01  5:53   ` sashiko-bot
2026-11-01  7:18   ` [PATCH v3] HID: wacom: replace sprintf calls with safer alternatives in wacom_sys.c Nehuen Lian Bova

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261101011439.261812-1-nehuenlian.kernel@gmail.com \
    --to=nehuenlian.kernel@gmail.com \
    --cc=bentiss@kernel.org \
    --cc=jikos@kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox