Re: Fix simscsi for new SCSI midlayer

From: Luck, Tony <tony.luck_at_intel.com>
Date: 2005-09-17 03:08:21
On Thu, Sep 15, 2005 at 03:35:03PM +1000, Peter Chubb wrote:
> +	char localbuf[60];

What is the magic number "60"? Shouldn't this be some kind of structure?

> -			buf = sc->request_buffer;
> +			buf = localbuf;

Ahh, I see, you inherited this avoidance of real structure ... but the
60 only needs to be 36, yes?

>  			buf[0] = 0;	/* magnetic disk */
>  			buf[1] = 0;	/* not a removable medium */
>  			buf[2] = 2;	/* SCSI-2 compliant device */
>  			buf[3] = 2;	/* SCSI-2 response data format */
>  			buf[4] = 31;	/* additional length (bytes) */
>  			buf[5] = 0;	/* reserved */
>  			buf[6] = 0;	/* reserved */
>  			buf[7] = 0;	/* various flags */
>  			memcpy(buf + 8, "HP      SIMULATED DISK  0.00",  28);
> +			simscsi_fillresult(sc, buf, 34);

28 + 8 = 36 ... so you lose the "00" by only copying 34 bytes.

-Tony
-
To unsubscribe from this list: send the line "unsubscribe linux-ia64" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Received on Sat Sep 17 03:08:46 2005

This archive was generated by hypermail 2.1.8 : 2005-09-17 03:09:03 EST