From f5fd6f5375a11efe08dc0b8d3f211f68d9095612 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Sat, 19 Apr 2014 11:48:33 +0000 Subject: [PATCH] scst_vdisk, COMPARE AND WRITE: Convert a kernel warning into a SCSI sense code git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5448 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/dev_handlers/scst_vdisk.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scst/src/dev_handlers/scst_vdisk.c b/scst/src/dev_handlers/scst_vdisk.c index e7c63c20f..b432c7118 100644 --- a/scst/src/dev_handlers/scst_vdisk.c +++ b/scst/src/dev_handlers/scst_vdisk.c @@ -5117,7 +5117,10 @@ static enum compl_status_e vdisk_exec_caw(struct vdisk_cmd_params *p) goto out; } - WARN_ON_ONCE(length != 2 * data_len); + if (length != 2 * data_len) { + scst_set_invalid_field_in_cdb(cmd, 13, 0); + goto out; + } loff = p->loff; read = vdev_read_sync(virt_dev, read_buf, data_len, &loff);