Skip to content

Commit

Permalink
cciss: call BUG() earlier
Browse files Browse the repository at this point in the history
I moved the range check after the increment.  The current code would
write past the end of the array once before calling BUG().

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
  • Loading branch information
Dan Carpenter authored and Jens Axboe committed Jun 1, 2010
1 parent 099c5c3 commit 713b686
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/block/cciss_scsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,11 +188,11 @@ scsi_cmd_free(ctlr_info_t *h, CommandList_struct *cmd)

sa = h->scsi_ctlr;
stk = &sa->cmd_stack;
stk->top++;
if (stk->top >= CMD_STACK_SIZE) {
printk("cciss: scsi_cmd_free called too many times.\n");
BUG();
}
stk->top++;
stk->elem[stk->top] = (struct cciss_scsi_cmd_stack_elem_t *) cmd;
}

Expand Down

0 comments on commit 713b686

Please sign in to comment.