diff options
author | Julia Lawall <julia@diku.dk> | 2010-10-29 15:14:18 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2010-10-29 15:14:18 -0400 |
commit | 2354d08fe9aeec3e451b85cb5387a6b28dbca0b1 (patch) | |
tree | 7a3f43dfac81fc54faf231400a4b871ca24bb031 /fs/direct-io.c | |
parent | 18e503d695ff8ff9a43768555aa74575bf6b77f3 (diff) |
Btrfs: use memdup_user helpers
Use memdup_user when user data is immediately copied into the
allocated region.
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: Chris Mason <chris.mason@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/direct-io.c')
0 files changed, 0 insertions, 0 deletions