patch-2.1.4 linux/ipc/msg.c

Next file: linux/ipc/sem.c
Previous file: linux/include/scsi/scsi_ioctl.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.3/linux/ipc/msg.c linux/ipc/msg.c
@@ -104,7 +104,8 @@
 		err = verify_area (VERIFY_READ, msgp->mtext, msgsz);
 		if (err) 
 			return err;
-		if ((mtype = get_user (&msgp->mtype)) < 1)
+		get_user(mtype, &msgp->mtype);
+		if (mtype < 1)
 			return -EINVAL;
 	}
 	id = (unsigned int) msqid % MSGMNI;
@@ -165,7 +166,7 @@
 		memcpy(msgh->msg_spot + KDHDR, kdmp->text, msgsz - KDHDR); 
 	}
 	else
-		memcpy_fromfs (msgh->msg_spot, msgp->mtext, msgsz); 
+		copy_from_user (msgh->msg_spot, msgp->mtext, msgsz); 
 	
 	if (msgque[id] == IPC_UNUSED || msgque[id] == IPC_NOID
 		|| msq->msg_perm.seq != (unsigned int) msqid / MSGMNI) {
@@ -370,7 +371,7 @@
 			}
 			else {
 				put_user (nmsg->msg_type, &msgp->mtype);
-				memcpy_tofs (msgp->mtext, nmsg->msg_spot, msgsz);
+				copy_to_user (msgp->mtext, nmsg->msg_spot, msgsz);
 			}
 			kfree(nmsg);
 			return msgsz;
@@ -566,7 +567,7 @@
 		err = verify_area (VERIFY_WRITE, buf, sizeof (struct msginfo));
 		if (err)
 			return err;
-		memcpy_tofs (buf, &msginfo, sizeof(struct msginfo));
+		copy_to_user (buf, &msginfo, sizeof(struct msginfo));
 		return max_msqid;
 	}
 	case MSG_STAT:
@@ -592,7 +593,7 @@
 		tbuf.msg_qbytes = msq->msg_qbytes;
 		tbuf.msg_lspid  = msq->msg_lspid;
 		tbuf.msg_lrpid  = msq->msg_lrpid;
-		memcpy_tofs (buf, &tbuf, sizeof(*buf));
+		copy_to_user (buf, &tbuf, sizeof(*buf));
 		return id;
 	case IPC_SET:
 		if (!buf)
@@ -600,7 +601,7 @@
 		err = verify_area (VERIFY_READ, buf, sizeof (*buf));
 		if (err)
 			return err;
-		memcpy_fromfs (&tbuf, buf, sizeof (*buf));
+		copy_from_user (&tbuf, buf, sizeof (*buf));
 		break;
 	case IPC_STAT:
 		if (!buf)
@@ -632,7 +633,7 @@
 		tbuf.msg_qbytes = msq->msg_qbytes;
 		tbuf.msg_lspid  = msq->msg_lspid;
 		tbuf.msg_lrpid  = msq->msg_lrpid;
-		memcpy_tofs (buf, &tbuf, sizeof (*buf));
+		copy_to_user (buf, &tbuf, sizeof (*buf));
 		return 0;
 	case IPC_SET:
 		if (!suser() && current->euid != ipcp->cuid && 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov