Commit 2c9f8805 authored by Andrew Patterson's avatar Andrew Patterson Committed by Linus Torvalds

[PATCH] cciss: Off-by-one error causing oops in CCISS_GETLUNIFO ioctl

This patch fixes an an "off-by-one" error found in the CCISS_GETLUNIFO
ioctl in the cciss driver.  It is cycling through the part table of the
gendisk structure which is a zero-based array, not a one-based array.  This
often causes an oops when referencing the out-of-bounds element.

Signed-off by: Andrew Patterson <andrew.patterson@hp.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 8c46a631
......@@ -809,7 +809,7 @@ static int cciss_ioctl(struct inode *inode, struct file *filep,
luninfo.num_opens = drv->usage_count;
luninfo.num_parts = 0;
/* count partitions 1 to 15 with sizes > 0 */
for(i=1; i <MAX_PART; i++) {
for (i = 0; i < MAX_PART - 1; i++) {
if (!disk->part[i])
continue;
if (disk->part[i]->nr_sects != 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment