From: Dan Carpenter <dan.carpenter@oracle.com>
To: Nestor Lopez Casado <nlopezcasad@logitech.com>
Cc: "open list:HID CORE LAYER" <linux-input@vger.kernel.org>,
Jiri Kosina <jkosina@suse.cz>
Subject: [smatch stuff] hid-logitech-dj: off by one range checking
Date: Tue, 20 Sep 2011 11:06:22 +0300 [thread overview]
Message-ID: <20110920080622.GA7611@elgon.mountain> (raw)
Hi Nestor,
Smatch complains about an off by one range check here. It looks like
a bug, but I'm not sure the correct fix.
drivers/hid/hid-logitech-dj.c +278 logi_dj_recv_add_djhid_device(66)
error: buffer overflow 'djrcv_dev->paired_dj_devices' 6 <= 6
233 if ((dj_report->device_index < DJ_DEVICE_INDEX_MIN) ||
234 (dj_report->device_index > DJ_DEVICE_INDEX_MAX)) {
235 dev_err(&djrcv_hdev->dev, "%s: invalid device index:%d\n",
236 __func__, dj_report->device_index);
237 return;
238 }
DJ_DEVICE_INDEX_MIN is 1
DJ_DEVICE_INDEX_MAX is 6
278 djrcv_dev->paired_dj_devices[dj_report->device_index] = dj_dev;
->paired_dj_devices[] has 6 elements so if dj_report->device_index is
6 we're one past the end of the array.
regards,
dan carpenter
reply other threads:[~2011-09-20 8:06 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20110920080622.GA7611@elgon.mountain \
--to=dan.carpenter@oracle.com \
--cc=jkosina@suse.cz \
--cc=linux-input@vger.kernel.org \
--cc=nlopezcasad@logitech.com \
/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