| /// Use memdup_user rather than duplicating its implementation |
| /// This is a little bit restricted to reduce false positives |
| // Copyright: (C) 2010-2012 Nicolas Palix. GPLv2. |
| // Copyright: (C) 2010-2012 Julia Lawall, INRIA/LIP6. GPLv2. |
| // Copyright: (C) 2010-2012 Gilles Muller, INRIA/LiP6. GPLv2. |
| // URL: http://coccinelle.lip6.fr/ |
| // Options: --no-includes --include-headers |
| - to = \(kmalloc\|kzalloc\)(size,GFP_KERNEL); |
| + to = memdup_user(from,size); |
| - if (copy_from_user(to, from, size) != 0) { |
| * to = \(kmalloc@p\|kzalloc@p\)(size,GFP_KERNEL); |
| if (copy_from_user(to, from, size) != 0) |
| @script:python depends on org@ |
| coccilib.org.print_todo(p[0], "WARNING opportunity for memdup_user") |
| @script:python depends on report@ |
| coccilib.report.print_report(p[0], "WARNING opportunity for memdup_user") |