diff mbox

[15/18] scsi: storvsc: Initialize driver-private command before using it

Message ID 20170519183016.12646-16-bart.vanassche@sandisk.com (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Bart Van Assche May 19, 2017, 6:30 p.m. UTC
The storvsc driver is the only SCSI LLD that uses driver-private
command data and that does not zero-initialize that data before
reading it. Make this driver consistent with the other SCSI LLDs
that use driver-private command data.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.com>
Cc: Long Li <longli@microsoft.com>
Cc: K. Y. Srinivasan <kys@microsoft.com>
---
 drivers/scsi/storvsc_drv.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Christoph Hellwig May 21, 2017, 6:51 a.m. UTC | #1
On Fri, May 19, 2017 at 11:30:13AM -0700, Bart Van Assche wrote:
> The storvsc driver is the only SCSI LLD that uses driver-private
> command data and that does not zero-initialize that data before
> reading it. Make this driver consistent with the other SCSI LLDs
> that use driver-private command data.

Well.  Either we add zeroing to storvsc and remove it from common
code, or we remove the zeroing from the drivers.

We shouldn't do both.  Given that we already zero the remaining
command it seems to me like keeping the zeroing in common code
would be preferred, but I'm open to discussion.
Bart Van Assche May 22, 2017, 5:15 p.m. UTC | #2
On Sun, 2017-05-21 at 08:51 +0200, Christoph Hellwig wrote:
> On Fri, May 19, 2017 at 11:30:13AM -0700, Bart Van Assche wrote:
> > The storvsc driver is the only SCSI LLD that uses driver-private
> > command data and that does not zero-initialize that data before
> > reading it. Make this driver consistent with the other SCSI LLDs
> > that use driver-private command data.
> 
> Well.  Either we add zeroing to storvsc and remove it from common
> code, or we remove the zeroing from the drivers.
> 
> We shouldn't do both.  Given that we already zero the remaining
> command it seems to me like keeping the zeroing in common code
> would be preferred, but I'm open to discussion.

Hello Christoph,

I will remove the code that zeroes driver-private command data from the other
SCSI LLDs and add it to the scsi-sq request preparation code path.

Bart.
diff mbox

Patch

diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c
index 8d955db6424f..cc08593c5218 100644
--- a/drivers/scsi/storvsc_drv.c
+++ b/drivers/scsi/storvsc_drv.c
@@ -1550,6 +1550,7 @@  static int storvsc_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *scmnd)
 		}
 	}
 
+	memset(cmd_request, 0, sizeof(*cmd_request));
 	/* Setup the cmd request */
 	cmd_request->cmd = scmnd;