From: sashiko-bot@kernel.org
To: "Guillaume Casal" <guillaume.casal.42@gmail.com>
Cc: dmitry.torokhov@gmail.com, linux-input@vger.kernel.org
Subject: Re: [PATCH 2/3] input: ff-memless: Add trigger left/right in ml_combine_effects
Date: Thu, 30 Jul 2026 10:24:40 +0000 [thread overview]
Message-ID: <20260730102440.947661F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260730095317.767418-3-guillaume.casal.42@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Critical] Extending `struct ff_rumble_effect` breaks backward compatibility for legacy userspace applications by interpreting uninitialized union padding as valid rumble magnitudes.
--
--- Patch [2]: [PATCH 2/3] input: ff-memless: Add trigger left/right in ml_combine_effects ---
commit 3748260413928654275c7c17fc4ca45fccc0a9ee
Author: Daniel Bomar <dbdaniel42@gmail.com>
input: ff-memless: Add trigger left/right in ml_combine_effects
Combine the new trigger magnitudes alongside the existing strong and weak
magnitudes, so that drivers using input_ff_create_memless() receive them
the same way.
> diff --git a/drivers/input/ff-memless.c b/drivers/input/ff-memless.c
> index d1fefd1dfc0de..f6e7f5e93c687 100644
> --- a/drivers/input/ff-memless.c
> +++ b/drivers/input/ff-memless.c
[ ... ]
> @@ -269,6 +269,8 @@ static void ml_combine_effects(struct ff_effect *effect,
> case FF_RUMBLE:
> strong = (u32)new->u.rumble.strong_magnitude * gain / 0xffff;
> weak = (u32)new->u.rumble.weak_magnitude * gain / 0xffff;
> + trigger_left = (u32)new->u.rumble.trigger_left * gain / 0xffff;
> + trigger_right = (u32)new->u.rumble.trigger_right * gain / 0xffff;
[Severity: Critical]
Does interpreting these new fields break backward compatibility for legacy
userspace applications?
Because struct ff_rumble_effect is part of a union dominated by larger
structs in struct ff_effect, extending its size did not change the total size
of struct ff_effect.
Legacy applications allocating struct ff_effect on the stack, setting
type = FF_RUMBLE, and initializing only strong_magnitude and weak_magnitude
could unknowingly pass uninitialized bytes to the kernel.
Since this code actively scales and applies trigger_left and trigger_right,
wouldn't those uninitialized bytes from the stack result in random trigger
vibrations?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260730095317.767418-1-guillaume.casal.42@gmail.com?part=2
next prev parent reply other threads:[~2026-07-30 10:24 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-30 9:53 [PATCH 0/3] input: force feedback for trigger rumble motors Guillaume Casal
2026-07-30 9:53 ` [PATCH 1/3] input: uapi: Add trigger_left and trigger_right to ff_rumble_effect struct Guillaume Casal
2026-07-30 10:04 ` sashiko-bot
2026-07-30 9:53 ` [PATCH 2/3] input: ff-memless: Add trigger left/right in ml_combine_effects Guillaume Casal
2026-07-30 10:24 ` sashiko-bot [this message]
2026-07-30 9:53 ` [PATCH 3/3] input: Add FF_TRIGGER_RUMBLE capability bit Guillaume Casal
2026-07-30 10:39 ` sashiko-bot
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=20260730102440.947661F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=guillaume.casal.42@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox