summaryrefslogtreecommitdiff
path: root/security/keys/persistent.c
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2019-06-26 23:02:31 +0300
committerDavid Howells <dhowells@redhat.com>2019-06-26 23:02:31 +0300
commitf771fde82051976a6fc0fd570f8b86de4a92124b (patch)
tree9721996d5d081b26f4c8a76fa275c01585030ba3 /security/keys/persistent.c
parent3b8c4a08a471d56ecaaca939c972fdf5b8255629 (diff)
downloadlinux-f771fde82051976a6fc0fd570f8b86de4a92124b.tar.xz
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/persistent.c')
-rw-r--r--security/keys/persistent.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/security/keys/persistent.c b/security/keys/persistent.c
index d0cb5b32eff7..fc29ec59efa7 100644
--- a/security/keys/persistent.c
+++ b/security/keys/persistent.c
@@ -87,6 +87,7 @@ static long key_get_persistent(struct user_namespace *ns, kuid_t uid,
index_key.type = &key_type_keyring;
index_key.description = buf;
index_key.desc_len = sprintf(buf, "_persistent.%u", from_kuid(ns, uid));
+ key_set_index_key(&index_key);
if (ns->persistent_keyring_register) {
reg_ref = make_key_ref(ns->persistent_keyring_register, true);