From ad96a7a7ea950d5bc9755f2f568be185c7070f1e Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Tue, 20 Jul 2010 20:08:59 -0600 Subject: [PATCH] drivers/block: use memdup_user Use memdup_user when user data is immediately copied into the allocated region. Some checkpatch cleanups in nearby code. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ 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 - ...+> - } // Signed-off-by: Julia Lawall Cc: Chirag Kantharia Signed-off-by: Andrew Morton Signed-off-by: Jens Axboe --- Reading git-format-patch failed