Skip to content

Commit 049ae60

Browse files
rddunlapJames Morris
authored andcommitted
security: commoncap: clean up kernel-doc comments
Fix kernel-doc notation in commoncap.c. Use correct (matching) function name in comments as in code. Use correct function argument names in kernel-doc comments. Use kernel-doc's "Return:" format for function return values. Fixes these kernel-doc warnings: ../security/commoncap.c:1206: warning: expecting prototype for cap_task_ioprio(). Prototype was for cap_task_setioprio() instead ../security/commoncap.c:1219: warning: expecting prototype for cap_task_ioprio(). Prototype was for cap_task_setnice() instead Signed-off-by: Randy Dunlap <[email protected]> Reviewed-by: Serge Hallyn <[email protected]> Signed-off-by: James Morris <[email protected]>
1 parent 82e5d8c commit 049ae60

File tree

1 file changed

+33
-17
lines changed

1 file changed

+33
-17
lines changed

security/commoncap.c

Lines changed: 33 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ static void warn_setuid_and_fcaps_mixed(const char *fname)
5050
/**
5151
* cap_capable - Determine whether a task has a particular effective capability
5252
* @cred: The credentials to use
53-
* @ns: The user namespace in which we need the capability
53+
* @targ_ns: The user namespace in which we need the capability
5454
* @cap: The capability to check for
5555
* @opts: Bitmask of options defined in include/linux/security.h
5656
*
@@ -289,7 +289,7 @@ int cap_capset(struct cred *new,
289289
* affects the security markings on that inode, and if it is, should
290290
* inode_killpriv() be invoked or the change rejected.
291291
*
292-
* Returns 1 if security.capability has a value, meaning inode_killpriv()
292+
* Return: 1 if security.capability has a value, meaning inode_killpriv()
293293
* is required, 0 otherwise, meaning inode_killpriv() is not required.
294294
*/
295295
int cap_inode_need_killpriv(struct dentry *dentry)
@@ -307,7 +307,7 @@ int cap_inode_need_killpriv(struct dentry *dentry)
307307
*
308308
* Erase the privilege-enhancing security markings on an inode.
309309
*
310-
* Returns 0 if successful, -ve on error.
310+
* Return: 0 if successful, -ve on error.
311311
*/
312312
int cap_inode_killpriv(struct dentry *dentry)
313313
{
@@ -490,7 +490,7 @@ static bool validheader(size_t size, const struct vfs_cap_data *cap)
490490
* User requested a write of security.capability. If needed, update the
491491
* xattr to change from v2 to v3, or to fixup the v3 rootid.
492492
*
493-
* If all is ok, we return the new size, on error return < 0.
493+
* Return: On success, return the new size; on error, return < 0.
494494
*/
495495
int cap_convert_nscap(struct dentry *dentry, const void **ivalue, size_t size)
496496
{
@@ -822,7 +822,9 @@ static inline bool nonroot_raised_pE(struct cred *new, const struct cred *old,
822822
*
823823
* Set up the proposed credentials for a new execution context being
824824
* constructed by execve(). The proposed creds in @bprm->cred is altered,
825-
* which won't take effect immediately. Returns 0 if successful, -ve on error.
825+
* which won't take effect immediately.
826+
*
827+
* Return: 0 if successful, -ve on error.
826828
*/
827829
int cap_bprm_creds_from_file(struct linux_binprm *bprm, struct file *file)
828830
{
@@ -1049,7 +1051,9 @@ static inline void cap_emulate_setxuid(struct cred *new, const struct cred *old)
10491051
* @flags: Indications of what has changed
10501052
*
10511053
* Fix up the results of setuid() call before the credential changes are
1052-
* actually applied, returning 0 to grant the changes, -ve to deny them.
1054+
* actually applied.
1055+
*
1056+
* Return: 0 to grant the changes, -ve to deny them.
10531057
*/
10541058
int cap_task_fix_setuid(struct cred *new, const struct cred *old, int flags)
10551059
{
@@ -1119,33 +1123,39 @@ static int cap_safe_nice(struct task_struct *p)
11191123
* @p: The task to affect
11201124
*
11211125
* Detemine if the requested scheduler policy change is permitted for the
1122-
* specified task, returning 0 if permission is granted, -ve if denied.
1126+
* specified task.
1127+
*
1128+
* Return: 0 if permission is granted, -ve if denied.
11231129
*/
11241130
int cap_task_setscheduler(struct task_struct *p)
11251131
{
11261132
return cap_safe_nice(p);
11271133
}
11281134

11291135
/**
1130-
* cap_task_ioprio - Detemine if I/O priority change is permitted
1136+
* cap_task_setioprio - Detemine if I/O priority change is permitted
11311137
* @p: The task to affect
11321138
* @ioprio: The I/O priority to set
11331139
*
11341140
* Detemine if the requested I/O priority change is permitted for the specified
1135-
* task, returning 0 if permission is granted, -ve if denied.
1141+
* task.
1142+
*
1143+
* Return: 0 if permission is granted, -ve if denied.
11361144
*/
11371145
int cap_task_setioprio(struct task_struct *p, int ioprio)
11381146
{
11391147
return cap_safe_nice(p);
11401148
}
11411149

11421150
/**
1143-
* cap_task_ioprio - Detemine if task priority change is permitted
1151+
* cap_task_setnice - Detemine if task priority change is permitted
11441152
* @p: The task to affect
11451153
* @nice: The nice value to set
11461154
*
11471155
* Detemine if the requested task priority change is permitted for the
1148-
* specified task, returning 0 if permission is granted, -ve if denied.
1156+
* specified task.
1157+
*
1158+
* Return: 0 if permission is granted, -ve if denied.
11491159
*/
11501160
int cap_task_setnice(struct task_struct *p, int nice)
11511161
{
@@ -1175,12 +1185,15 @@ static int cap_prctl_drop(unsigned long cap)
11751185
/**
11761186
* cap_task_prctl - Implement process control functions for this security module
11771187
* @option: The process control function requested
1178-
* @arg2, @arg3, @arg4, @arg5: The argument data for this function
1188+
* @arg2: The argument data for this function
1189+
* @arg3: The argument data for this function
1190+
* @arg4: The argument data for this function
1191+
* @arg5: The argument data for this function
11791192
*
11801193
* Allow process control functions (sys_prctl()) to alter capabilities; may
11811194
* also deny access to other functions not otherwise implemented here.
11821195
*
1183-
* Returns 0 or +ve on success, -ENOSYS if this function is not implemented
1196+
* Return: 0 or +ve on success, -ENOSYS if this function is not implemented
11841197
* here, other -ve on error. If -ENOSYS is returned, sys_prctl() and other LSM
11851198
* modules will consider performing the function.
11861199
*/
@@ -1315,7 +1328,9 @@ int cap_task_prctl(int option, unsigned long arg2, unsigned long arg3,
13151328
* @pages: The size of the mapping
13161329
*
13171330
* Determine whether the allocation of a new virtual mapping by the current
1318-
* task is permitted, returning 1 if permission is granted, 0 if not.
1331+
* task is permitted.
1332+
*
1333+
* Return: 1 if permission is granted, 0 if not.
13191334
*/
13201335
int cap_vm_enough_memory(struct mm_struct *mm, long pages)
13211336
{
@@ -1328,14 +1343,15 @@ int cap_vm_enough_memory(struct mm_struct *mm, long pages)
13281343
return cap_sys_admin;
13291344
}
13301345

1331-
/*
1346+
/**
13321347
* cap_mmap_addr - check if able to map given addr
13331348
* @addr: address attempting to be mapped
13341349
*
13351350
* If the process is attempting to map memory below dac_mmap_min_addr they need
13361351
* CAP_SYS_RAWIO. The other parameters to this function are unused by the
1337-
* capability security module. Returns 0 if this mapping should be allowed
1338-
* -EPERM if not.
1352+
* capability security module.
1353+
*
1354+
* Return: 0 if this mapping should be allowed or -EPERM if not.
13391355
*/
13401356
int cap_mmap_addr(unsigned long addr)
13411357
{

0 commit comments

Comments
 (0)