Skip to content

Commit

Permalink
[PATCH 2/3] cciss: bug fix for BIG_PASS_THRU
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jens Axboe committed Nov 18, 2005
1 parent 7f0d503 commit 15534d3
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions drivers/block/cciss.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 15534d3

Please sign in to comment.