From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Arnd Bergmann <arnd@kernel.org>
Cc: Dudley Du <dudl@cypress.com>, Arnd Bergmann <arnd@arndb.de>,
"Gustavo A. R. Silva" <gustavoars@kernel.org>,
linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] input: cyapa_gen6: fix out-of-bounds stack access
Date: Mon, 14 Dec 2020 15:00:18 -0800 [thread overview]
Message-ID: <X9fugmc5XldpHqnW@google.com> (raw)
In-Reply-To: <20201026161332.3708389-1-arnd@kernel.org>
On Mon, Oct 26, 2020 at 05:13:29PM +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> gcc -Warray-bounds warns about a serious bug in
> cyapa_pip_retrieve_data_structure:
>
> drivers/input/mouse/cyapa_gen6.c: In function 'cyapa_pip_retrieve_data_structure.constprop':
> include/linux/unaligned/access_ok.h:40:17: warning: array subscript -1 is outside array bounds of 'struct retrieve_data_struct_cmd[1]' [-Warray-bounds]
> 40 | *((__le16 *)p) = cpu_to_le16(val);
> drivers/input/mouse/cyapa_gen6.c:569:13: note: while referencing 'cmd'
> 569 | } __packed cmd;
> | ^~~
>
> Apparently the '-2' was added to the pointer instead of the value,
> writing garbage into the stack next to this variable.
>
> Fixes: c2c06c41f700 ("Input: cyapa - add gen6 device module support")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Applied, thank you.
--
Dmitry
prev parent reply other threads:[~2020-12-14 23:01 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-26 16:13 [PATCH] input: cyapa_gen6: fix out-of-bounds stack access Arnd Bergmann
2020-12-14 23:00 ` 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=X9fugmc5XldpHqnW@google.com \
--to=dmitry.torokhov@gmail.com \
--cc=arnd@arndb.de \
--cc=arnd@kernel.org \
--cc=dudl@cypress.com \
--cc=gustavoars@kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@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 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.