[PATCH] Several FreeBSD CAM changes merge

Xin LI delphij at frontfree.net
Tue Mar 15 09:04:18 PST 2005


FYI.  It seems that same issue exists in DFly as well, please review
the patch and consider a commit.

Cheers,
-- 
Xin LI <delphij frontfree net>	http://www.delphij.net/
See complete headers for GPG key and other information.

Index: cam_periph.c
===================================================================
RCS file: /home/dcvs/src/sys/bus/cam/cam_periph.c,v
retrieving revision 1.8
diff -u -r1.8 cam_periph.c
--- cam_periph.c	12 Mar 2004 03:23:13 -0000	1.8
+++ cam_periph.c	15 Mar 2005 16:54:06 -0000
@@ -399,7 +399,12 @@
 		if (strcmp((*p_drv)->driver_name, periph->periph_name) == 0)
 			break;
 	}
-	
+
+	if (*p_drv == NULL) {
+		printf("camperiphfree: attempt to free non-existant periph\n");
+		return;
+	}
+
 	if (periph->periph_dtor != NULL)
 		periph->periph_dtor(periph);
 	
Index: cam_xpt.c
===================================================================
RCS file: /home/dcvs/src/sys/bus/cam/cam_xpt.c,v
retrieving revision 1.22
diff -u -r1.22 cam_xpt.c
--- cam_xpt.c	5 Mar 2005 18:29:24 -0000	1.22
+++ cam_xpt.c	15 Mar 2005 16:51:19 -0000
@@ -2333,7 +2333,7 @@
 					break;
 			}
 
-			if (pdrv == NULL) {
+			if (*pdrv == NULL) {
 				cdm->status = CAM_DEV_MATCH_ERROR;
 				return(0);
 			}
Index: scsi/scsi_all.c
===================================================================
RCS file: /home/dcvs/src/sys/bus/cam/scsi/scsi_all.c,v
retrieving revision 1.4
diff -u -r1.4 scsi_all.c
--- scsi/scsi_all.c	29 Dec 2003 06:42:10 -0000	1.4
+++ scsi/scsi_all.c	15 Mar 2005 16:59:42 -0000
@@ -1689,7 +1689,7 @@
 			 * XXX KDM this is stupid, but casting the
 			 * structure doesn't work...
 			 */
-			bcopy(&csio->sense_data, sense, 
+			bcopy(&csio->sense_data, &sense, 
 			      sizeof(struct scsi_sense_data *));
 		}
 	} else {
@@ -1874,7 +1874,7 @@
 			 * XXX KDM this is stupid, but casting the
 			 * structure doesn't work...
 			 */
-			bcopy(&csio->sense_data, sense, 
+			bcopy(&csio->sense_data, &sense, 
 			      sizeof(struct scsi_sense_data *));
 		}
 	} else {
Index: scsi/scsi_target.c
===================================================================
RCS file: /home/dcvs/src/sys/bus/cam/scsi/scsi_target.c,v
retrieving revision 1.9
diff -u -r1.9 scsi_target.c
--- scsi/scsi_target.c	19 May 2004 22:52:38 -0000	1.9
+++ scsi/scsi_target.c	15 Mar 2005 16:55:03 -0000
@@ -532,7 +532,6 @@
 		  ("write - uio_resid %d\n", uio->uio_resid));
 	while (uio->uio_resid >= sizeof(user_ccb) && error == 0) {
 		union ccb *ccb;
-		int error;
 
 		error = uiomove((caddr_t)&user_ccb, sizeof(user_ccb), uio);
 		if (error != 0) {
Attachment:
pgp00009.pgp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pgp00009.pgp
Type: application/octet-stream
Size: 187 bytes
Desc: "Description: PGP signature"
URL: <http://lists.dragonflybsd.org/pipermail/submit/attachments/20050315/c37f863d/attachment-0018.obj>


More information about the Submit mailing list