Skip to content

Commit a8b17ed

Browse files
dhowellstorvalds
authored andcommitted
KEYS: Do some style cleanup in the key management code.
Do a bit of a style clean up in the key management code. No functional changes. Done using: perl -p -i -e 's!^/[*]*/\n!!' security/keys/*.c perl -p -i -e 's!} /[*] end [a-z0-9_]*[(][)] [*]/\n!}\n!' security/keys/*.c sed -i -s -e ": next" -e N -e 's/^\n[}]$/}/' -e t -e P -e 's/^.*\n//' -e "b next" security/keys/*.c To remove /*****/ lines, remove comments on the closing brace of a function to name the function and remove blank lines before the closing brace of a function. Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 9093ba5 commit a8b17ed

10 files changed

Lines changed: 80 additions & 248 deletions

File tree

‎security/keys/compat.c‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#include <linux/compat.h>
1515
#include "internal.h"
1616

17-
/*****************************************************************************/
1817
/*
1918
* the key control system call, 32-bit compatibility version for 64-bit archs
2019
* - this should only be called if the 64-bit arch uses weird pointers in
@@ -88,5 +87,4 @@ asmlinkage long compat_sys_keyctl(u32 option,
8887
default:
8988
return -EOPNOTSUPP;
9089
}
91-
92-
} /* end compat_sys_keyctl() */
90+
}

‎security/keys/encrypted_defined.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -888,7 +888,6 @@ static int __init init_encrypted(void)
888888
out:
889889
encrypted_shash_release();
890890
return ret;
891-
892891
}
893892

894893
static void __exit cleanup_encrypted(void)

‎security/keys/key.c‎

Lines changed: 20 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ void __key_check(const struct key *key)
5656
}
5757
#endif
5858

59-
/*****************************************************************************/
6059
/*
6160
* get the key quota record for a user, allocating a new record if one doesn't
6261
* already exist
@@ -130,10 +129,8 @@ struct key_user *key_user_lookup(uid_t uid, struct user_namespace *user_ns)
130129
kfree(candidate);
131130
out:
132131
return user;
132+
}
133133

134-
} /* end key_user_lookup() */
135-
136-
/*****************************************************************************/
137134
/*
138135
* dispose of a user structure
139136
*/
@@ -146,10 +143,8 @@ void key_user_put(struct key_user *user)
146143

147144
kfree(user);
148145
}
146+
}
149147

150-
} /* end key_user_put() */
151-
152-
/*****************************************************************************/
153148
/*
154149
* assign a key the next unique serial number
155150
* - these are assigned randomly to avoid security issues through covert
@@ -211,10 +206,8 @@ static inline void key_alloc_serial(struct key *key)
211206
if (key->serial < xkey->serial)
212207
goto attempt_insertion;
213208
}
209+
}
214210

215-
} /* end key_alloc_serial() */
216-
217-
/*****************************************************************************/
218211
/*
219212
* allocate a key of the specified type
220213
* - update the user's quota to reflect the existence of the key
@@ -344,12 +337,10 @@ struct key *key_alloc(struct key_type *type, const char *desc,
344337
key_user_put(user);
345338
key = ERR_PTR(-EDQUOT);
346339
goto error;
347-
348-
} /* end key_alloc() */
340+
}
349341

350342
EXPORT_SYMBOL(key_alloc);
351343

352-
/*****************************************************************************/
353344
/*
354345
* reserve an amount of quota for the key's payload
355346
*/
@@ -384,12 +375,10 @@ int key_payload_reserve(struct key *key, size_t datalen)
384375
key->datalen = datalen;
385376

386377
return ret;
387-
388-
} /* end key_payload_reserve() */
378+
}
389379

390380
EXPORT_SYMBOL(key_payload_reserve);
391381

392-
/*****************************************************************************/
393382
/*
394383
* instantiate a key and link it into the target keyring atomically
395384
* - called with the target keyring's semaphore writelocked
@@ -441,10 +430,8 @@ static int __key_instantiate_and_link(struct key *key,
441430
wake_up_bit(&key->flags, KEY_FLAG_USER_CONSTRUCT);
442431

443432
return ret;
433+
}
444434

445-
} /* end __key_instantiate_and_link() */
446-
447-
/*****************************************************************************/
448435
/*
449436
* instantiate a key and link it into the target keyring atomically
450437
*/
@@ -471,12 +458,10 @@ int key_instantiate_and_link(struct key *key,
471458
__key_link_end(keyring, key->type, prealloc);
472459

473460
return ret;
474-
475-
} /* end key_instantiate_and_link() */
461+
}
476462

477463
EXPORT_SYMBOL(key_instantiate_and_link);
478464

479-
/*****************************************************************************/
480465
/*
481466
* negatively instantiate a key and link it into the target keyring atomically
482467
*/
@@ -535,12 +520,10 @@ int key_negate_and_link(struct key *key,
535520
wake_up_bit(&key->flags, KEY_FLAG_USER_CONSTRUCT);
536521

537522
return ret == 0 ? link_ret : ret;
538-
539-
} /* end key_negate_and_link() */
523+
}
540524

541525
EXPORT_SYMBOL(key_negate_and_link);
542526

543-
/*****************************************************************************/
544527
/*
545528
* do cleaning up in process context so that we don't have to disable
546529
* interrupts all over the place
@@ -601,10 +584,8 @@ static void key_cleanup(struct work_struct *work)
601584

602585
/* there may, of course, be more than one key to destroy */
603586
goto go_again;
587+
}
604588

605-
} /* end key_cleanup() */
606-
607-
/*****************************************************************************/
608589
/*
609590
* dispose of a reference to a key
610591
* - when all the references are gone, we schedule the cleanup task to come and
@@ -618,12 +599,10 @@ void key_put(struct key *key)
618599
if (atomic_dec_and_test(&key->usage))
619600
schedule_work(&key_cleanup_task);
620601
}
621-
622-
} /* end key_put() */
602+
}
623603

624604
EXPORT_SYMBOL(key_put);
625605

626-
/*****************************************************************************/
627606
/*
628607
* find a key by its serial number
629608
*/
@@ -664,10 +643,8 @@ struct key *key_lookup(key_serial_t id)
664643
error:
665644
spin_unlock(&key_serial_lock);
666645
return key;
646+
}
667647

668-
} /* end key_lookup() */
669-
670-
/*****************************************************************************/
671648
/*
672649
* find and lock the specified key type against removal
673650
* - we return with the sem readlocked
@@ -690,20 +667,16 @@ struct key_type *key_type_lookup(const char *type)
690667

691668
found_kernel_type:
692669
return ktype;
670+
}
693671

694-
} /* end key_type_lookup() */
695-
696-
/*****************************************************************************/
697672
/*
698673
* unlock a key type
699674
*/
700675
void key_type_put(struct key_type *ktype)
701676
{
702677
up_read(&key_types_sem);
678+
}
703679

704-
} /* end key_type_put() */
705-
706-
/*****************************************************************************/
707680
/*
708681
* attempt to update an existing key
709682
* - the key has an incremented refcount
@@ -742,10 +715,8 @@ static inline key_ref_t __key_update(key_ref_t key_ref,
742715
key_put(key);
743716
key_ref = ERR_PTR(ret);
744717
goto out;
718+
}
745719

746-
} /* end __key_update() */
747-
748-
/*****************************************************************************/
749720
/*
750721
* search the specified keyring for a key of the same description; if one is
751722
* found, update it, otherwise add a new one
@@ -855,12 +826,10 @@ key_ref_t key_create_or_update(key_ref_t keyring_ref,
855826

856827
key_ref = __key_update(key_ref, payload, plen);
857828
goto error;
858-
859-
} /* end key_create_or_update() */
829+
}
860830

861831
EXPORT_SYMBOL(key_create_or_update);
862832

863-
/*****************************************************************************/
864833
/*
865834
* update a key
866835
*/
@@ -891,12 +860,10 @@ int key_update(key_ref_t key_ref, const void *payload, size_t plen)
891860

892861
error:
893862
return ret;
894-
895-
} /* end key_update() */
863+
}
896864

897865
EXPORT_SYMBOL(key_update);
898866

899-
/*****************************************************************************/
900867
/*
901868
* revoke a key
902869
*/
@@ -926,12 +893,10 @@ void key_revoke(struct key *key)
926893
}
927894

928895
up_write(&key->sem);
929-
930-
} /* end key_revoke() */
896+
}
931897

932898
EXPORT_SYMBOL(key_revoke);
933899

934-
/*****************************************************************************/
935900
/*
936901
* register a type of key
937902
*/
@@ -956,12 +921,10 @@ int register_key_type(struct key_type *ktype)
956921
out:
957922
up_write(&key_types_sem);
958923
return ret;
959-
960-
} /* end register_key_type() */
924+
}
961925

962926
EXPORT_SYMBOL(register_key_type);
963927

964-
/*****************************************************************************/
965928
/*
966929
* unregister a type of key
967930
*/
@@ -1010,12 +973,10 @@ void unregister_key_type(struct key_type *ktype)
1010973
up_write(&key_types_sem);
1011974

1012975
key_schedule_gc(0);
1013-
1014-
} /* end unregister_key_type() */
976+
}
1015977

1016978
EXPORT_SYMBOL(unregister_key_type);
1017979

1018-
/*****************************************************************************/
1019980
/*
1020981
* initialise the key management stuff
1021982
*/
@@ -1037,5 +998,4 @@ void __init key_init(void)
1037998

1038999
rb_insert_color(&root_key_user.node,
10391000
&key_user_tree);
1040-
1041-
} /* end key_init() */
1001+
}

0 commit comments

Comments
 (0)