All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: xujiahao <xujiahao@cmss.chinamobile.com>
Cc: linux-input@vger.kernel.org, dmitry.torokhov@gmail.com
Subject: Re: [PATCH v2] Input: sidewinder - use scnprintf() for the port names
Date: Mon, 09 Nov 2026 01:31:11 +0000	[thread overview]
Message-ID: <sashiko-outbox-204298@kernel.org> (raw)
In-Reply-To: <20261109010548.438699-1-xujiahao@cmss.chinamobile.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] Input: sidewinder - 64-bit division in sw_3dp_id() breaks
  32-bit builds
--

commit 126f9830817fff924c0c3fe1b867c22b8b4a2692
Author: xujiahao <xujiahao@cmss.chinamobile.com>

Input: sidewinder - use scnprintf() for the port names

This commit switches sw_3dp_id() and sw_connect() from snprintf() to
scnprintf() to silence -Wformat-truncation warnings.

Link: https://lore.kernel.org/all/20261106033300.3439313-1-xujiahao@cmss.chinamobile.com/

> diff --git a/drivers/input/joystick/sidewinder.c b/drivers/input/joystick/sidewinder.c
> index 7f37d18c8477a..bca81df19da44 100644
> --- a/drivers/input/joystick/sidewinder.c
> +++ b/drivers/input/joystick/sidewinder.c
> @@ -535,12 +535,12 @@ static void sw_3dp_id(unsigned char *buf, char *comment, size_t size)
>  
>  	pnp[7] = rev[8] = 0;
>  
> -	snprintf(comment, size, " [PnP %d.%02d id %s rev %s]",
> -		(int) ((sw_get_bits(buf, 8, 6, 1) << 6) |		/* Two 6-bit values */
> -			sw_get_bits(buf, 16, 6, 1)) / 100,
> -		(int) ((sw_get_bits(buf, 8, 6, 1) << 6) |
> -			sw_get_bits(buf, 16, 6, 1)) % 100,
> -		 pnp, rev);
> +	scnprintf(comment, size, " [PnP %d.%02d id %s rev %s]",
> +		  (int)(((sw_get_bits(buf, 8, 6, 1) << 6) |	/* Two 6-bit values */
> +			  sw_get_bits(buf, 16, 6, 1)) / 100),
> +		  (int)(((sw_get_bits(buf, 8, 6, 1) << 6) |
> +			  sw_get_bits(buf, 16, 6, 1)) % 100),
> +		  pnp, rev);
>  }

[Severity: High]
Does wrapping `/ 100` and `% 100` inside the `(int)` cast break the build on
32-bit architectures?

sw_get_bits() returns `__u64`.  Previously, the `(int)` cast truncated the
bitwise OR result before dividing by 100, whereas moving the outer
parentheses around `/ 100` and `% 100` turns them into 64-bit unsigned
division and modulo, emitting undefined references to `__udivdi3` and
`__umoddi3` (or `__aeabi_uldivmod`) at link time on 32-bit targets.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261109010548.438699-1-xujiahao@cmss.chinamobile.com?part=1

  reply	other threads:[~2026-11-09  1:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-06  3:33 [PATCH] Input: sidewinder - size the name buffers to their formats xujiahao
2026-11-08  6:33 ` Dmitry Torokhov
2026-11-09  1:05 ` [PATCH v2] Input: sidewinder - use scnprintf() for the port names xujiahao
2026-11-09  1:31   ` sashiko-bot [this message]
2026-11-09 10:45   ` kernel test robot
2026-11-09 20:08   ` kernel test robot
2026-11-10  1:48   ` [PATCH v3] " xujiahao

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