Commit 713b6864 authored by Dan Carpenter's avatar Dan Carpenter Committed by Jens Axboe
Browse files

cciss: call BUG() earlier

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: default avatarDan Carpenter <>
Signed-off-by: default avatarJens Axboe <>
parent 099c5c31
...@@ -188,11 +188,11 @@ scsi_cmd_free(ctlr_info_t *h, CommandList_struct *cmd) ...@@ -188,11 +188,11 @@ scsi_cmd_free(ctlr_info_t *h, CommandList_struct *cmd)
sa = h->scsi_ctlr; sa = h->scsi_ctlr;
stk = &sa->cmd_stack; stk = &sa->cmd_stack;
if (stk->top >= CMD_STACK_SIZE) { if (stk->top >= CMD_STACK_SIZE) {
printk("cciss: scsi_cmd_free called too many times.\n"); printk("cciss: scsi_cmd_free called too many times.\n");
BUG(); BUG();
} }
stk->elem[stk->top] = (struct cciss_scsi_cmd_stack_elem_t *) cmd; stk->elem[stk->top] = (struct cciss_scsi_cmd_stack_elem_t *) cmd;
} }
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