From: sashiko-bot@kernel.org
To: "Aibing Chen" <chenaibing@cmss.chinamobile.com>
Cc: linux-input@vger.kernel.org, dmitry.torokhov@gmail.com
Subject: Re: [PATCH 1/2] Input: joystick: use scnprintf() for the device physical paths
Date: Fri, 27 Nov 2026 04:05:07 +0000 [thread overview]
Message-ID: <sashiko-outbox-236572@kernel.org> (raw)
In-Reply-To: <20261127034904.288-1-chenaibing@cmss.chinamobile.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] Input: joystick: cobra and stinger physical paths still use
snprintf()
--
commit dad6d0895b43b6671b115696abcf12d42b3f99fb
Author: Aibing Chen <chenaibing@cmss.chinamobile.com>
Input: joystick: use scnprintf() for the device physical paths
This commit switches thirteen joystick drivers from snprintf() to
scnprintf() when formatting input device physical paths to silence W=1
-Wformat-truncation warnings.
> diff --git a/drivers/input/joystick/grip.c b/drivers/input/joystick/grip.c
> index 2a3f768a72186..f685a62cad6de 100644
> --- a/drivers/input/joystick/grip.c
> +++ b/drivers/input/joystick/grip.c
> @@ -333,7 +333,7 @@ static int grip_connect(struct gameport *gameport, struct gameport_driver *drv)
> goto fail3;
> }
>
> - snprintf(grip->phys[i], sizeof(grip->phys[i]),
> + scnprintf(grip->phys[i], sizeof(grip->phys[i]),
> "%s/input%d", gameport->phys, i);
>
> input_dev->name = grip_name[grip->mode[i]];
> diff --git a/drivers/input/joystick/magellan.c b/drivers/input/joystick/magellan.c
> index 201a049c8c06b..61fcf0620937c 100644
> --- a/drivers/input/joystick/magellan.c
> +++ b/drivers/input/joystick/magellan.c
> @@ -138,7 +138,7 @@ static int magellan_connect(struct serio *serio, struct serio_driver *drv)
> goto fail1;
>
> magellan->dev = input_dev;
> - snprintf(magellan->phys, sizeof(magellan->phys), "%s/input0", serio->phys);
> + scnprintf(magellan->phys, sizeof(magellan->phys), "%s/input0", serio->phys);
>
> input_dev->name = "LogiCad3D Magellan / SpaceMouse";
> input_dev->phys = magellan->phys;
[Severity: Low]
Should cobra_connect() in drivers/input/joystick/cobra.c and
stinger_connect() in drivers/input/joystick/stinger.c also be converted to
scnprintf()?
They format 32-byte gameport->phys and serio->phys strings into 32-byte
phys buffers with snprintf() and hit the same W=1 -Wformat-truncation
error under CONFIG_WERROR:
drivers/input/joystick/cobra.c:cobra_connect() {
...
snprintf(cobra->phys[i], sizeof(cobra->phys[i]),
"%s/input%d", gameport->phys, i);
...
}
drivers/input/joystick/stinger.c:stinger_connect() {
...
snprintf(stinger->phys, sizeof(stinger->phys), "%s/serio0", serio->phys);
...
}
Also, the commit message says the drivers compose their physical path from
gameport->phys, whereas six of the modified drivers (magellan, spaceball,
spaceorb, twidjoy, warrior, and zhenhua) compose it from serio->phys.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261127034904.288-1-chenaibing@cmss.chinamobile.com?part=1
prev parent reply other threads:[~2026-11-27 4:05 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-27 3:49 [PATCH 1/2] Input: joystick: use scnprintf() for the device physical paths Aibing Chen
2026-11-27 3:49 ` [PATCH 2/2] Input: sidewinder: use scnprintf() for the comment and physical path Aibing Chen
2026-11-27 4:05 ` sashiko-bot [this message]
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-236572@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=chenaibing@cmss.chinamobile.com \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.org \
--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 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.