aboutsummaryrefslogtreecommitdiffstats
path: root/security/keys/key.c
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2019-06-26 21:02:31 +0100
committerDavid Howells <dhowells@redhat.com>2019-06-26 21:02:31 +0100
commitf771fde82051976a6fc0fd570f8b86de4a92124b (patch)
tree9721996d5d081b26f4c8a76fa275c01585030ba3 /security/keys/key.c
parentkeys: Kill off request_key_async{,_with_auxdata} (diff)
downloadlinux-dev-f771fde82051976a6fc0fd570f8b86de4a92124b.tar.xz
linux-dev-f771fde82051976a6fc0fd570f8b86de4a92124b.zip
keys: Simplify key description management
Simplify key description management by cramming the word containing the length with the first few chars of the description also. This simplifies the code that generates the index-key used by assoc_array. It should speed up key searching a bit too. Signed-off-by: David Howells <dhowells@redhat.com>
Diffstat (limited to 'security/keys/key.c')
-rw-r--r--security/keys/key.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/security/keys/key.c b/security/keys/key.c
index e792d65c0af8..0a3828f15f57 100644
--- a/security/keys/key.c
+++ b/security/keys/key.c
@@ -285,6 +285,7 @@ struct key *key_alloc(struct key_type *type, const char *desc,
key->index_key.description = kmemdup(desc, desclen + 1, GFP_KERNEL);
if (!key->index_key.description)
goto no_memory_3;
+ key_set_index_key(&key->index_key);
refcount_set(&key->usage, 1);
init_rwsem(&key->sem);
@@ -868,6 +869,7 @@ key_ref_t key_create_or_update(key_ref_t keyring_ref,
goto error_free_prep;
}
index_key.desc_len = strlen(index_key.description);
+ key_set_index_key(&index_key);
ret = __key_link_lock(keyring, &index_key);
if (ret < 0) {