[PATCH 2.4] cciss: fix for passthru ioctls

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxx>
---------------------------------------------------------------------------------------
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++;
-
: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux