mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: mike.miller@hp.com
To: marcelo.tosatti@cyclades.com, axboe@suse.de
Cc: linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org
Subject: [PATCH 2.4] cciss: fix for passthru ioctls
Date: Mon, 16 May 2005 15:16:31 -0500	[thread overview]
Message-ID: <20050516201631.GA6725@beardog.cca.cpqcorp.net> (raw)

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 <mike.miller@hp.com>
---------------------------------------------------------------------------------------
diff -burNp lx2431-pre2.orig/drivers/block/cciss.c lx2431-pre2/drivers/block/cciss.c
--- lx2431-pre2.orig/drivers/block/cciss.c	2004-11-17 05:54:21.000000000 -0600
+++ lx2431-pre2/drivers/block/cciss.c	2005-05-16 14:08:18.189638408 -0500
@@ -975,10 +975,10 @@ static int cciss_ioctl(struct inode *ino
 			{
 				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 @@ static int cciss_ioctl(struct inode *ino
 				   /* 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++;

                 reply	other threads:[~2005-05-16 21:20 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050516201631.GA6725@beardog.cca.cpqcorp.net \
    --to=mike.miller@hp.com \
    --cc=axboe@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=marcelo.tosatti@cyclades.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®