qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 10/16] scsi: move request parsing to common code


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH 10/16] scsi: move request parsing to common code
Date: Fri, 12 Aug 2011 19:11:22 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:5.0) Gecko/20110707 Thunderbird/5.0

On 08/12/2011 06:55 PM, Peter Maydell wrote:
Does it still make sense to set req->cmd to cmd (and to look at cmd
at all) in the case where scsi_req_parse() failed and might not have
actually initialised all of cmd? For instance the tracing code (added
to scsi_req_new() after this patch) looks at cmd.buf[] based on the
value of buf[0], which seems kind of fragile to me.

At the point tracing is reached, we know that cmd.buf[] has been initialized. But you're right that it is at least not tidy.

We know that the size of the cdb is 16 (it is always like that, and we can make it a requirement). So we can copy it to cmd->buf before knowing cmd->len, at the beginning of scsi_req_parse. We can also zero unconditionally len/xfer/mode (plus set lba to -1) in case the parsing fails.

Paolo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]