From: Silvan Jegen <s.jegen@gmail.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Stefan Achatz <erazor_de@users.sourceforge.net>,
Jiri Kosina <jikos@kernel.org>,
Benjamin Tissoires <benjamin.tissoires@redhat.com>,
linux-input@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] HID: roccat: prevent an out of bounds read in kovaplus_profile_activated()
Date: Mon, 15 Jan 2018 21:21:11 +0100 [thread overview]
Message-ID: <20180115202111.GA12555@myarchbang.localdomain> (raw)
In-Reply-To: <20180110093903.yyoknoi7oc2cd5iy@mwanda>
Hi
On Wed, Jan 10, 2018 at 12:39:03PM +0300, Dan Carpenter wrote:
> We get the "new_profile_index" value from the mouse device when we're
> handling raw events. Smatch taints it as untrusted data and complains
> that we need a bounds check. This seems like a reasonable warning
> otherwise there is a small read beyond the end of the array.
>
> Fixes: 0e70f97f257e ("HID: roccat: Add support for Kova[+] mouse")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Looks good to me.
Acked-by: Silvan Jegen <s.jegen@gmail.com>
> diff --git a/drivers/hid/hid-roccat-kovaplus.c b/drivers/hid/hid-roccat-kovaplus.c
> index 43617fb28b87..317c9c2c0a7c 100644
> --- a/drivers/hid/hid-roccat-kovaplus.c
> +++ b/drivers/hid/hid-roccat-kovaplus.c
> @@ -37,6 +37,8 @@ static uint kovaplus_convert_event_cpi(uint value)
> static void kovaplus_profile_activated(struct kovaplus_device *kovaplus,
> uint new_profile_index)
> {
> + if (new_profile_index >= ARRAY_SIZE(kovaplus->profile_settings))
> + return;
> kovaplus->actual_profile = new_profile_index;
> kovaplus->actual_cpi = kovaplus->profile_settings[new_profile_index].cpi_startup_level;
> kovaplus->actual_x_sensitivity = kovaplus->profile_settings[new_profile_index].sensitivity_x;
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2018-01-15 20:21 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-10 9:39 [PATCH] HID: roccat: prevent an out of bounds read in kovaplus_profile_activated() Dan Carpenter
2018-01-15 20:21 ` Silvan Jegen [this message]
2018-01-23 14:47 ` Jiri Kosina
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=20180115202111.GA12555@myarchbang.localdomain \
--to=s.jegen@gmail.com \
--cc=benjamin.tissoires@redhat.com \
--cc=dan.carpenter@oracle.com \
--cc=erazor_de@users.sourceforge.net \
--cc=jikos@kernel.org \
--cc=kernel-janitors@vger.kernel.org \
--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).