mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Patterson <andrew.patterson@hp.com>
To: linux-kernel@vger.kernel.org
Cc: Mike Miller <Mike.Miller@hp.com>
Subject: [PATCH] cciss: Off-by-one error causing oops in CCISS_GETLUNIFO ioctl
Date: Wed, 24 Nov 2004 11:27:04 -0700	[thread overview]
Message-ID: <1101320824.30680.15.camel@bluto.andrew> (raw)

[-- Attachment #1: Type: text/plain, Size: 809 bytes --]

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>
---

--- linux-2.6.9/drivers/block/cciss.c.orig	2004-11-24 10:22:30.000000000 -0700
+++ linux-2.6.9/drivers/block/cciss.c	2004-11-24 10:27:38.000000000 -0700
@@ -799,7 +799,7 @@
  		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)



[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

                 reply	other threads:[~2004-11-24 19:21 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=1101320824.30680.15.camel@bluto.andrew \
    --to=andrew.patterson@hp.com \
    --cc=Mike.Miller@hp.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®