mtd/drivers/mtd mtdchar.c,1.68,1.69

gleixner at infradead.org gleixner at infradead.org
Thu Mar 17 14:56:10 EST 2005


Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv26254

Modified Files:
	mtdchar.c 
Log Message:
Merge from mainstream.

[PATCH] verify_area cleanup : drivers part 2

This patch converts the second half of drivers from verify_area to
access_ok.

Signed-off-by: Jesper Juhl <juhl-lkml at dif.dk>



Index: mtdchar.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/mtdchar.c,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -r1.68 -r1.69
--- mtdchar.c	8 Feb 2005 19:12:50 -0000	1.68
+++ mtdchar.c	17 Mar 2005 19:56:08 -0000	1.69
@@ -325,12 +325,12 @@
 
 	size = (cmd & IOCSIZE_MASK) >> IOCSIZE_SHIFT;
 	if (cmd & IOC_IN) {
-		ret = verify_area(VERIFY_READ, argp, size);
-		if (ret) return ret;
+		if (!access_ok(VERIFY_READ, argp, size))
+			return -EFAULT;
 	}
 	if (cmd & IOC_OUT) {
-		ret = verify_area(VERIFY_WRITE, argp, size);
-		if (ret) return ret;
+		if (!access_ok(VERIFY_WRITE, argp, size))
+			return -EFAULT;
 	}
 	
 	switch (cmd) {
@@ -429,7 +429,8 @@
 		if (!mtd->write_oob)
 			ret = -EOPNOTSUPP;
 		else
-			ret = verify_area(VERIFY_READ, buf.ptr, buf.length);
+			ret = access_ok(VERIFY_READ, buf.ptr,
+					buf.length) ? 0 : EFAULT;
 
 		if (ret)
 			return ret;
@@ -468,7 +469,8 @@
 		if (!mtd->read_oob)
 			ret = -EOPNOTSUPP;
 		else
-			ret = verify_area(VERIFY_WRITE, buf.ptr, buf.length);
+			ret = access_ok(VERIFY_WRITE, buf.ptr,
+					buf.length) ? 0 : -EFAULT;
 
 		if (ret)
 			return ret;





More information about the linux-mtd-cvs mailing list