Subject: Re: datalen in scsi cmds
To: Manuel Bouyer <bouyer@antioche.lip6.fr>
From: Eduardo E. Horvath <eeh@one-o.com>
List: tech-kern
Date: 08/05/1998 12:38:22
On Wed, 5 Aug 1998, Manuel Bouyer wrote:

> Hi,
> 
> While working on DMA for atapi devices, I  noticed that some scsi
> drivers actually uses unions for data returned by these commands.
> The result is that the datalen passed may be greater than the real
> size of the transfert (some audio CD commands do this).
> Could't this break with some SCSI adapters drivers ? This is also the
> reason of the "wdc_atapi_intr warning: bcount value is %d after io" messages
> you can see with a DIAGNOSTIC kernel.
> 
> Actually, as a sanity check I check that DMA transfered the expected
> number of bytes. But of course this break if the upper level gave us the
> wrong data size.

In numerous instances, such as inquiry, the drivers have no idea how much
information the disk might return.  They just allocate some memory and
encode that in the CDB to tell the disk the maximum that the driver will
accept.

> Should I fix the scsi driver, or remove my check from the IDE/ATAPI driver ?

I would remove the check for underruns.  (Overruns, however, may cause
data corruption if they DMA the extra data into memory.)

=========================================================================
Eduardo Horvath				eeh@one-o.com
	"I need to find a pithy new quote." -- me