diff options
author | Geliang Tang <geliangtang@163.com> | 2015-10-21 16:04:46 +0300 |
---|---|---|
committer | David Howells <dhowells@redhat.com> | 2015-10-21 17:18:35 +0300 |
commit | d0e0eba043c78b1d6ce3d29367abb41446d83747 (patch) | |
tree | 1c86a75564f33450917f0ea9468bc1dd47ef994f /security | |
parent | 09302fd19efbff9569eaad3f78ead8f411defd87 (diff) | |
download | linux-d0e0eba043c78b1d6ce3d29367abb41446d83747.tar.xz |
KEYS: use kvfree() in add_key
There is no need to make a flag to tell that this memory is allocated by
kmalloc or vmalloc. Just use kvfree to free the memory.
Signed-off-by: Geliang Tang <geliangtang@163.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Diffstat (limited to 'security')
-rw-r--r-- | security/keys/keyctl.c | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/security/keys/keyctl.c b/security/keys/keyctl.c index 0b9ec78a7a7a..6110fa498494 100644 --- a/security/keys/keyctl.c +++ b/security/keys/keyctl.c @@ -67,7 +67,6 @@ SYSCALL_DEFINE5(add_key, const char __user *, _type, char type[32], *description; void *payload; long ret; - bool vm; ret = -EINVAL; if (plen > 1024 * 1024 - 1) @@ -98,14 +97,12 @@ SYSCALL_DEFINE5(add_key, const char __user *, _type, /* pull the payload in if one was supplied */ payload = NULL; - vm = false; if (_payload) { ret = -ENOMEM; payload = kmalloc(plen, GFP_KERNEL | __GFP_NOWARN); if (!payload) { if (plen <= PAGE_SIZE) goto error2; - vm = true; payload = vmalloc(plen); if (!payload) goto error2; @@ -138,10 +135,7 @@ SYSCALL_DEFINE5(add_key, const char __user *, _type, key_ref_put(keyring_ref); error3: - if (!vm) - kfree(payload); - else - vfree(payload); + kvfree(payload); error2: kfree(description); error: |