Skip to contentSkip to conversation

cciss update [4/5] fix for HP utilities

PATCH mikem 1 participant 1 message Aug 13, 2004 Block layer

lore
Share & tools
lore

mikem

author
#0 lore raw

Patch 4 of 5.
This patch fixes a problem with HP utilities. If a system has a combination of SCSI and SATA or SAS drives the utils can become confused and return bogus info.
Applies to 2.4.27. Please consider this for inclusion.

Thanks,
mikem
-----------------------------------------------------------------------------

drivers/block/cciss.c +6 -1
diff -burNp lx2427-p003/drivers/block/cciss.c lx2427/drivers/block/cciss.c
@@ -942,6 +942,8 @@ static int cciss_ioctl(struct inode *ino
 			{
 				kfree(buff);
 				return -EFAULT;
+			} else {
+				memset(buff, 0, iocommand.buf_size);
 			}
 		}
 		if ((c = cmd_alloc(h , 0)) == NULL) {
@@ -1060,12 +1062,15 @@ static int cciss_ioctl(struct inode *ino
 					goto cleanup1;
 				}
 				if (iocommand.Request.Type.Direction == 
-						XFER_WRITE)
+						XFER_WRITE) {
 				   /* Copy the data into the buffer created */
 				   if (copy_from_user(buff[sg_used], data_ptr, 
 						buff_size[sg_used])) {
 					status = -ENOMEM;
 					goto cleanup1;			
+				   } else {
+					memset(buff[sg_used], 0, buff_size[sg_used]);
+				   }
 				   }
 				size_left_alloc -= buff_size[sg_used];
 				data_ptr += buff_size[sg_used];