[PATCH] cciss: fix for passthru ioctls
Linux Kernel Mailing List <[email protected]> Thu, 19 May 2005 19:05:53 +0000
| Newsgroups | gmane.linux.kernel.commits.2-4 |
|---|---|
| Message-ID | <[email protected]> |
ChangeSet 1.1522, 2005/05/19 16:05:53-03:00, [email protected] [PATCH] cciss: fix for passthru ioctls The following patch fixes a problem in our passthru ioctls. I added a memset to zero out buffers before doing a read. Seems like I had a curly brace out of place. Thanks to Stanislav Semakin for pointing this out. Please consider this for inclusion. Signed-off-by: Mike Miller <[email protected]> cciss.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff -Nru a/drivers/block/cciss.c b/drivers/block/cciss.c --- a/drivers/block/cciss.c 2005-05-20 10:04:57 -07:00 +++ b/drivers/block/cciss.c 2005-05-20 10:04:57 -07:00 @@ -975,10 +975,10 @@ { kfree(buff); return -EFAULT; - } else { - memset(buff, 0, iocommand.buf_size); } } + else + memset(buff, 0, iocommand.buf_size); if ((c = cmd_alloc(h , 0)) == NULL) { kfree(buff); return -ENOMEM; @@ -1099,12 +1099,12 @@ /* Copy the data into the buffer created */ if (copy_from_user(buff[sg_used], data_ptr, buff_size[sg_used])) { - status = -ENOMEM; + status = -EFAULT; goto cleanup1; - } else { - memset(buff[sg_used], 0, buff_size[sg_used]); } } + else + memset(buff[sg_used], 0, buff_size[sg_used]); size_left_alloc -= buff_size[sg_used]; data_ptr += buff_size[sg_used]; sg_used++;