Skip to content

Commit fa20aeb

Browse files
committed
landlock: Improve kernel-doc "Return:" section consistency
The canonical kernel-doc form is "Return:" (singular, without trailing "s"). Normalize all existing "Returns:" occurrences across the Landlock source tree to the canonical form. Also fix capitalization for consistency. Balance descriptions to describe all possible returned values. Consolidate bullet-point return descriptions into inline text for functions with simple two-value or three-value returns for consistency. Cc: Günther Noack <gnoack@google.com> Reviewed-by: Günther Noack <gnoack3000@gmail.com> Link: https://lore.kernel.org/r/20260304193134.250495-3-mic@digikod.net Signed-off-by: Mickaël Salaün <mic@digikod.net>
1 parent e89dea2 commit fa20aeb

8 files changed

Lines changed: 25 additions & 34 deletions

File tree

security/landlock/cred.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ static inline bool landlocked(const struct task_struct *const task)
115115
* @handle_layer: returned youngest layer handling a subset of @masks. Not set
116116
* if the function returns NULL.
117117
*
118-
* Returns: landlock_cred(@cred) if any access rights specified in @masks is
118+
* Return: landlock_cred(@cred) if any access rights specified in @masks is
119119
* handled, or NULL otherwise.
120120
*/
121121
static inline const struct landlock_cred_security *

security/landlock/domain.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
* @exe_size: Returned size of @exe_str (including the trailing null
3535
* character), if any.
3636
*
37-
* Returns: A pointer to an allocated buffer where @exe_str point to, %NULL if
37+
* Return: A pointer to an allocated buffer where @exe_str point to, %NULL if
3838
* there is no executable path, or an error otherwise.
3939
*/
4040
static const void *get_current_exe(const char **const exe_str,
@@ -73,7 +73,7 @@ static const void *get_current_exe(const char **const exe_str,
7373
}
7474

7575
/*
76-
* Returns: A newly allocated object describing a domain, or an error
76+
* Return: A newly allocated object describing a domain, or an error
7777
* otherwise.
7878
*/
7979
static struct landlock_details *get_current_details(void)

security/landlock/fs.c

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,8 @@ static const struct landlock_object_underops landlock_fs_underops = {
119119
* Any new IOCTL commands that are implemented in fs/ioctl.c's do_vfs_ioctl()
120120
* should be considered for inclusion here.
121121
*
122-
* Returns: true if the IOCTL @cmd can not be restricted with Landlock for
123-
* device files.
122+
* Return: True if the IOCTL @cmd can not be restricted with Landlock for
123+
* device files, false otherwise.
124124
*/
125125
static __attribute_const__ bool is_masked_device_ioctl(const unsigned int cmd)
126126
{
@@ -428,10 +428,10 @@ static bool may_refer(const struct layer_access_masks *const src_parent,
428428
* Check that a destination file hierarchy has more restrictions than a source
429429
* file hierarchy. This is only used for link and rename actions.
430430
*
431-
* Returns: true if child1 may be moved from parent1 to parent2 without
432-
* increasing its access rights. If child2 is set, an additional condition is
431+
* Return: True if child1 may be moved from parent1 to parent2 without
432+
* increasing its access rights (if child2 is set, an additional condition is
433433
* that child2 may be used from parent2 to parent1 without increasing its access
434-
* rights.
434+
* rights), false otherwise.
435435
*/
436436
static bool no_more_access(const struct layer_access_masks *const parent1,
437437
const struct layer_access_masks *const child1,
@@ -734,9 +734,7 @@ static void test_is_eacces_with_write(struct kunit *const test)
734734
* checks that the collected accesses and the remaining ones are enough to
735735
* allow the request.
736736
*
737-
* Returns:
738-
* - true if the access request is granted;
739-
* - false otherwise.
737+
* Return: True if the access request is granted, false otherwise.
740738
*/
741739
static bool
742740
is_access_to_paths_allowed(const struct landlock_ruleset *const domain,
@@ -1022,9 +1020,8 @@ static access_mask_t maybe_remove(const struct dentry *const dentry)
10221020
* only handles walking on the same mount point and only checks one set of
10231021
* accesses.
10241022
*
1025-
* Returns:
1026-
* - true if all the domain access rights are allowed for @dir;
1027-
* - false if the walk reached @mnt_root.
1023+
* Return: True if all the domain access rights are allowed for @dir, false if
1024+
* the walk reached @mnt_root.
10281025
*/
10291026
static bool collect_domain_accesses(const struct landlock_ruleset *const domain,
10301027
const struct dentry *const mnt_root,
@@ -1120,10 +1117,9 @@ static bool collect_domain_accesses(const struct landlock_ruleset *const domain,
11201117
* ephemeral matrices take some space on the stack, which limits the number of
11211118
* layers to a deemed reasonable number: 16.
11221119
*
1123-
* Returns:
1124-
* - 0 if access is allowed;
1125-
* - -EXDEV if @old_dentry would inherit new access rights from @new_dir;
1126-
* - -EACCES if file removal or creation is denied.
1120+
* Return: 0 if access is allowed, -EXDEV if @old_dentry would inherit new
1121+
* access rights from @new_dir, or -EACCES if file removal or creation is
1122+
* denied.
11271123
*/
11281124
static int current_check_refer_path(struct dentry *const old_dentry,
11291125
const struct path *const new_dir,

security/landlock/id.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ static void test_range2_rand16(struct kunit *const test)
258258
*
259259
* @number_of_ids: Number of IDs to hold. Must be greater than one.
260260
*
261-
* Returns: The first ID in the range.
261+
* Return: The first ID in the range.
262262
*/
263263
u64 landlock_get_id_range(size_t number_of_ids)
264264
{

security/landlock/ruleset.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,7 @@ get_access_mask_t(const struct landlock_ruleset *const ruleset,
674674
* @masks: Layer access masks to populate.
675675
* @key_type: The key type to switch between access masks of different types.
676676
*
677-
* Returns: An access mask where each access right bit is set which is handled
677+
* Return: An access mask where each access right bit is set which is handled
678678
* in any of the active layers in @domain.
679679
*/
680680
access_mask_t

security/landlock/ruleset.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ static inline void landlock_get_ruleset(struct landlock_ruleset *const ruleset)
224224
*
225225
* @domain: Landlock ruleset (used as a domain)
226226
*
227-
* Returns: an access_masks result of the OR of all the domain's access masks.
227+
* Return: An access_masks result of the OR of all the domain's access masks.
228228
*/
229229
static inline struct access_masks
230230
landlock_union_access_masks(const struct landlock_ruleset *const domain)

security/landlock/task.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,8 @@ static int hook_ptrace_traceme(struct task_struct *const parent)
174174
* @server: IPC receiver domain.
175175
* @scope: The scope restriction criteria.
176176
*
177-
* Returns: True if @server is in a different domain from @client, and @client
178-
* is scoped to access @server (i.e. access should be denied).
177+
* Return: True if @server is in a different domain from @client and @client
178+
* is scoped to access @server (i.e. access should be denied), false otherwise.
179179
*/
180180
static bool domain_is_scoped(const struct landlock_ruleset *const client,
181181
const struct landlock_ruleset *const server,

security/landlock/tsync.c

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -183,10 +183,8 @@ struct tsync_works {
183183
* capacity. This can legitimately happen if new threads get started after we
184184
* grew the capacity.
185185
*
186-
* Returns:
187-
* A pointer to the preallocated context struct, with task filled in.
188-
*
189-
* NULL, if we ran out of preallocated context structs.
186+
* Return: A pointer to the preallocated context struct with task filled in, or
187+
* NULL if preallocated context structs ran out.
190188
*/
191189
static struct tsync_work *tsync_works_provide(struct tsync_works *s,
192190
struct task_struct *task)
@@ -243,11 +241,8 @@ static void tsync_works_trim(struct tsync_works *s)
243241
* On a successful return, the subsequent n calls to tsync_works_provide() are
244242
* guaranteed to succeed. (size + n <= capacity)
245243
*
246-
* Returns:
247-
* -ENOMEM if the (re)allocation fails
248-
249-
* 0 if the allocation succeeds, partially succeeds, or no reallocation
250-
* was needed
244+
* Return: 0 if sufficient space for n more elements could be provided, -ENOMEM
245+
* on allocation errors, -EOVERFLOW in case of integer overflow.
251246
*/
252247
static int tsync_works_grow_by(struct tsync_works *s, size_t n, gfp_t flags)
253248
{
@@ -363,8 +358,8 @@ static size_t count_additional_threads(const struct tsync_works *works)
363358
* For each added task_work, atomically increments shared_ctx->num_preparing and
364359
* shared_ctx->num_unfinished.
365360
*
366-
* Returns:
367-
* true, if at least one eligible sibling thread was found
361+
* Return: True if at least one eligible sibling thread was found, false
362+
* otherwise.
368363
*/
369364
static bool schedule_task_work(struct tsync_works *works,
370365
struct tsync_shared_context *shared_ctx)

0 commit comments

Comments
 (0)