]> err.no Git - linux-2.6/commitdiff
[PATCH 2/3] cciss: bug fix for BIG_PASS_THRU
authorJens Axboe <axboe@suse.de>
Fri, 18 Nov 2005 21:02:44 +0000 (22:02 +0100)
committerJens Axboe <axboe@suse.de>
Fri, 18 Nov 2005 21:02:44 +0000 (22:02 +0100)
Applications using CCISS_BIG_PASSTHRU complained that the data written
was zeros. The problem is that the buffer is being cleared after the
user copy, unless the user copy has failed... Correct that logic.

Signed-off-by: Mike Miller <mike.miller@hp.com>
Signed-off-by: Jens Axboe <axboe@suse.de>
drivers/block/cciss.c

index e239a6c2923052c4271f5d6414d7eec87f85b508..33f8341887d036e4805334e11aefe8ce9c1d1806 100644 (file)
@@ -1017,10 +1017,11 @@ static int cciss_ioctl(struct inode *inode, struct file *filep,
                                status = -ENOMEM;
                                goto cleanup1;
                        }
-                       if (ioc->Request.Type.Direction == XFER_WRITE &&
-                               copy_from_user(buff[sg_used], data_ptr, sz)) {
+                       if (ioc->Request.Type.Direction == XFER_WRITE) {
+                               if (copy_from_user(buff[sg_used], data_ptr, sz)) {
                                        status = -ENOMEM;
-                                       goto cleanup1;                  
+                                       goto cleanup1;
+                               }
                        } else {
                                memset(buff[sg_used], 0, sz);
                        }