Re: drivers/block/ub.c

From: Oliver Neukum
Date: Sat Jun 26 2004 - 17:47:40 EST


Am Samstag, 26. Juni 2004 22:06 schrieb Pete Zaitcev:
> +static int ub_submit_top_sense(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
> +{
> +       struct ub_scsi_cmd *scmd;
> +
> +       scmd = &sc->top_rqs_cmd;
> +
> +       /* XXX Can be done at init */
> +       scmd->cdb[0] = REQUEST_SENSE;
> +       scmd->cdb_len = 6;
> +       scmd->dir = UB_DIR_READ;
> +       scmd->state = UB_CMDST_INIT;
> +       scmd->data = sc->top_sense;

You must allocate a separate buffer to the sense data.
We had similar code in hid which leads to data corruption
on some architectures. It's an issue of DMA coherency.

> +       scmd->len = SENSE_SIZE;
> +       scmd->done = ub_top_sense_done;
> +       scmd->back = cmd;
> +
> +       scmd->tag = sc->tagcnt++;
> +       return ub_submit_scsi(sc, scmd);
> +}

Regards
Oliver
-
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/