Linux Input/HID development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Nehuen Lian Bova" <nehuenlian.kernel@gmail.com>
Cc: linux-input@vger.kernel.org, dmitry.torokhov@gmail.com
Subject: Re: [PATCH v2] HID: wacom: replace sprintf calls with safer alternatives
Date: Sun, 01 Nov 2026 05:53:02 +0000	[thread overview]
Message-ID: <sashiko-outbox-192283@kernel.org> (raw)
In-Reply-To: <20261101054830.291749-1-nehuenlian.kernel@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] HID: wacom: missing size argument in __wacom_initialize_battery() snprintf()
--

commit 3ae99c758bf47da8936a8a4c38001b6a0d39a084
Author: Nehuen Lian Bova <nehuenlian.kernel@gmail.com>

HID: wacom: replace sprintf calls with safer alternatives

This commit replaces sprintf() calls in drivers/hid/wacom_sys.c with
snprintf() in __wacom_initialize_battery() and sysfs_emit() in
wacom_show_remote_mode(), and includes <linux/sysfs.h>.

> diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c
> index 628372ab818a2..bb5bb9c15f935 100644
> --- a/drivers/hid/wacom_sys.c
> +++ b/drivers/hid/wacom_sys.c

[ ... ]

> @@ -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);
> +	snprintf(battery->bat_name, "wacom_battery_%ld", n);

[Severity: High]
Is the buffer size argument missing in this snprintf() call in
__wacom_initialize_battery()?

Because snprintf() expects the buffer size as its second parameter, passing
"wacom_battery_%ld" as the second argument and n as the format string pointer
causes a build failure due to incompatible pointer/integer types (or an
invalid pointer dereference when initializing a battery on device probe or
wireless connection).

Should this pass sizeof(battery->bat_name) as the second argument instead:

	snprintf(battery->bat_name, sizeof(battery->bat_name),
		 "wacom_battery_%ld", n);

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261101054830.291749-1-nehuenlian.kernel@gmail.com?part=1

  reply	other threads:[~2026-11-01  5:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-01  1:14 [PATCH] HID: wacom: replace sprintf calls with sysfs_emit calls in wacom_sys.c Nehuen Lian Bova
2026-11-01  1:19 ` 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 [this message]
2026-11-01  7:18   ` [PATCH v3] HID: wacom: replace sprintf calls with safer alternatives in wacom_sys.c Nehuen Lian Bova
2026-11-02 19:40     ` Jason Gerecke

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=sashiko-outbox-192283@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=nehuenlian.kernel@gmail.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /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