* [smatch stuff] hid-logitech-dj: off by one range checking
@ 2011-09-20 8:06 Dan Carpenter
0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2011-09-20 8:06 UTC (permalink / raw)
To: Nestor Lopez Casado; +Cc: open list:HID CORE LAYER, Jiri Kosina
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2011-09-20 8:06 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-20 8:06 [smatch stuff] hid-logitech-dj: off by one range checking Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox