linux-hardened/fs/autofs4
Julia Lawall 7ca5ca60cb fs/autofs4: use memdup_user
Use memdup_user when user data is immediately copied into the allocated
region.  Elimination of the variable ads, which is no longer useful.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression from,to,size,flag;
position p;
identifier l1,l2;
@@

-  to = \(kmalloc@p\|kzalloc@p\)(size,flag);
+  to = memdup_user(from,size);
   if (
-      to==NULL
+      IS_ERR(to)
                 || ...) {
   <+... when != goto l1;
-  -ENOMEM
+  PTR_ERR(to)
   ...+>
   }
-  if (copy_from_user(to, from, size) != 0) {
-    <+... when != goto l2;
-    -EFAULT
-    ...+>
-  }
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Cc: Ian Kent <raven@themaw.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2010-05-27 09:12:41 -07:00
..
autofs_i.h Revert "autofs4: always use lookup for lookup" 2010-03-03 12:58:31 -05:00
dev-ioctl.c fs/autofs4: use memdup_user 2010-05-27 09:12:41 -07:00
expire.c Revert "autofs4: always use lookup for lookup" 2010-03-03 12:58:31 -05:00
init.c autofs4: add miscellaneous device for ioctls 2008-10-16 11:21:39 -07:00
inode.c Use kill_litter_super() in autofs4 ->kill_sb() 2010-03-03 14:07:54 -05:00
Kconfig fs/Kconfig: move autofs, autofs4 out 2009-01-22 13:15:54 +03:00
Makefile autofs4: add miscellaneous device for ioctls 2008-10-16 11:21:39 -07:00
root.c autofs4: Pushdown the bkl from ioctl 2010-05-22 17:44:18 +02:00
symlink.c [PATCH] mark struct inode_operations const 1 2007-02-12 09:48:46 -08:00
waitq.c autofs4: remove hashed check in validate_wait() 2009-06-09 16:59:03 -07:00