From c45abddb0a9911fc20f0bd28cf614b688ae9959d Mon Sep 17 00:00:00 2001 From: Li Zefan Date: Sat, 18 Oct 2008 20:28:06 -0700 Subject: [PATCH] --- yaml --- r: 115931 b: refs/heads/master c: 2cdc7241a290bb2b9ef4c2e2969a4a3ed92abb63 h: refs/heads/master i: 115929: 5cec7380ea7dc19cb42eb2919ab69af6b9a354da 115927: c7d217b99dc1ffeee9bb1fd66db58dbf458cf20b v: v3 --- [refs] | 2 +- trunk/security/device_cgroup.c | 9 ++------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/[refs] b/[refs] index 473912dceb8a..55ac2d0d82a5 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 886465f407e57d6c3c81013c919ea670ce1ae0d0 +refs/heads/master: 2cdc7241a290bb2b9ef4c2e2969a4a3ed92abb63 diff --git a/trunk/security/device_cgroup.c b/trunk/security/device_cgroup.c index 46f23971f7e4..9c625f65ee56 100644 --- a/trunk/security/device_cgroup.c +++ b/trunk/security/device_cgroup.c @@ -84,13 +84,9 @@ static int dev_whitelist_copy(struct list_head *dest, struct list_head *orig) struct dev_whitelist_item *wh, *tmp, *new; list_for_each_entry(wh, orig, list) { - new = kmalloc(sizeof(*wh), GFP_KERNEL); + new = kmemdup(wh, sizeof(*wh), GFP_KERNEL); if (!new) goto free_and_exit; - new->major = wh->major; - new->minor = wh->minor; - new->type = wh->type; - new->access = wh->access; list_add_tail(&new->list, dest); } @@ -114,11 +110,10 @@ static int dev_whitelist_add(struct dev_cgroup *dev_cgroup, { struct dev_whitelist_item *whcopy, *walk; - whcopy = kmalloc(sizeof(*whcopy), GFP_KERNEL); + whcopy = kmemdup(wh, sizeof(*wh), GFP_KERNEL); if (!whcopy) return -ENOMEM; - memcpy(whcopy, wh, sizeof(*whcopy)); spin_lock(&dev_cgroup->lock); list_for_each_entry(walk, &dev_cgroup->whitelist, list) { if (walk->type != wh->type)