Re: [PATCH] HID: tmff: Use 64-bit arithmetic for force feedback scaling
Jiri Kosina <[email protected]>
| Newsgroups | org.kernel.vger.linux-input,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
On Fri, 10 Jul 2026, Linmao Li wrote:
> The logical minimum and maximum values come from the HID report
> descriptor and cover the full signed 32-bit range. Subtracting them in
> an int can overflow before the force feedback value is scaled. The
> subsequent multiplication can overflow as well, producing an incorrect
> value despite the final range checks.
>
> Use 64-bit intermediates for both scaling helpers, as done by commit
> 48d1677779ad ("HID: pidff: Fix integer overflow in pidff_rescale") for
> the same arithmetic in the PID driver. This keeps the arithmetic
> defined for the complete descriptor range before the result is clamped.
>
> Fixes: dc76c912145f ("Input: use new FF interface in the HID force feedback drivers")
> Fixes: b27c9590ca0f ("HID: add support for Thrustmaster FGT Force Feedback wheel")
> Signed-off-by: Linmao Li <[email protected]>
Applied, thanks.
--
Jiri Kosina
SUSE Labs