From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Anssi Hannula <anssi.hannula@gmail.com>
Cc: linux-input@vger.kernel.org, Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
Subject: Re: [PATCH] ff-memless: fix signed to unsigned bit overflow in?ml_combile_effects()
Date: Thu, 7 May 2009 19:10:45 -0700 [thread overview]
Message-ID: <20090508021045.GA30616@dtor-d630.eng.vmware.com> (raw)
In-Reply-To: <4A03748E.3060709@gmail.com>
On Thursday 07 May 2009 16:53:50 Anssi Hannula wrote:
> Jussi Kivilinna wrote:
> > When userspace sets effect->u.rumble.strong_magnitude to 0x8001 or
> > larger, ml_combine_effects() would always return strong_magnitude 0xffff.
> >
> > Problem is that 'gain' is passed in as signed integer. Multiplying
> > magnitude (__u16) with gain (int) causes magnitude read as signed and
> > results negative value (with magnitude > 0x8000). This signed integer is
> > then divided and value, still negative, converted to 32bit unsigned
> > integer. Finally checking combine overflow min(new+old, 0xffff) gives out
> > 0xffff.
> >
> > Fix is to simply change 'gain' to unsigned int.
> >
> > Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
>
> Acked-by: Anssi Hannula <anssi.hannula@gmail.com>
>
Applied, thank you.
--
Dmitry
prev parent reply other threads:[~2009-05-08 2:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-07 19:32 [PATCH] ff-memless: fix signed to unsigned bit overflow in ml_combile_effects() Jussi Kivilinna
2009-05-07 23:53 ` Anssi Hannula
2009-05-08 2:10 ` Dmitry Torokhov [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=20090508021045.GA30616@dtor-d630.eng.vmware.com \
--to=dmitry.torokhov@gmail.com \
--cc=anssi.hannula@gmail.com \
--cc=jussi.kivilinna@mbnet.fi \
--cc=linux-input@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).