aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2012-03-29 21:52:57 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-04-10 09:18:59 -0700
commit3fd654c22c7b002e8681accaed50a6d46656d815 (patch)
tree563fa1c91ab64dae91a04254efe6be3ce9029c8f /drivers/staging
parentstaging: ozwpan: Added new maintainer for ozwpan (diff)
downloadlinux-dev-3fd654c22c7b002e8681accaed50a6d46656d815.tar.xz
linux-dev-3fd654c22c7b002e8681accaed50a6d46656d815.zip
Staging: rts_pstor: off by one in for loop
I already fixed the other similar for loop in this file. I'm not sure how I missed this one. We use seg_no+1 inside the loop so we can't go right up to the end of the loop. Also if we don't break out of the loop then we end up past the end of the array, but with this fix we end up on the last element. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/rts_pstor/ms.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/staging/rts_pstor/ms.c b/drivers/staging/rts_pstor/ms.c
index 66341dff8c99..f9a4498984cc 100644
--- a/drivers/staging/rts_pstor/ms.c
+++ b/drivers/staging/rts_pstor/ms.c
@@ -3498,7 +3498,8 @@ static int ms_rw_multi_sector(struct scsi_cmnd *srb, struct rtsx_chip *chip, u32
log_blk++;
- for (seg_no = 0; seg_no < sizeof(ms_start_idx)/2; seg_no++) {
+ for (seg_no = 0; seg_no < ARRAY_SIZE(ms_start_idx) - 1;
+ seg_no++) {
if (log_blk < ms_start_idx[seg_no+1])
break;
}