Re: cciss update [1/2] updates our SCSI support to not use deprecated headers pass 3

From: Jens Axboe
Date: Wed Oct 13 2004 - 19:12:26 EST


On Wed, Oct 13 2004, mike.miller@xxxxxx wrote:
> @@ -552,11 +547,16 @@ cciss_scsi_setup(int cntl_num)
> static void
> complete_scsi_command( CommandList_struct *cp, int timeout, __u32 tag)
> {
> - Scsi_Cmnd *cmd;
> + struct scsi_cmnd *cmd;
> ctlr_info_t *ctlr;
> u64bit addr64;
> ErrorInfo_struct *ei;
>
> + cmd = kmalloc(sizeof(struct scsi_cmnd), GFP_ATOMIC);
> + if(cmd == NULL) {
> + printk(KERN_WARNING "out of memory\n");
> + return;
> + }
> ei = cp->err_info;
>
> /* First, see if it was a message rather than a command */
> @@ -565,7 +565,7 @@ complete_scsi_command( CommandList_struc
> return;
> }
>
> - cmd = (Scsi_Cmnd *) cp->scsi_cmd;
> + cmd = (struct scsi_cmnd *) cp->scsi_cmd;
> ctlr = hba[cp->ctlr];

This makes zero sense. First of all, you can't just quit out of
completing a command based on a weird allocation failure. Secondly, why
are you allocation cmd at completion time (??) and then overwriting it a
few lines later.

--
Jens Axboe

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/