kernel/groups.c: remove return value of set_groups
Subsystems (2)
PATCH 1/1 kernel/groups.c: remove return value of set_groups
After commit 6307f8fee295b364716d28686df6e69c2fee751a ("security: remove dead hook task_setgroups"), set_groups will always return zero, so we could just remove return value of set_groups.
This patch reduce code size, and simplfy code logician to use set_groups, because we don't need to check its return value anymore.
---
I can't find out the maintainer of kernel/group.c, so... I hope I haven't send and cc to the wrong people :)
fs/nfsd/auth.c | 5 +---- include/linux/cred.h | 2 +- kernel/groups.c | 11 ++--------- 3 files changed, 4 insertions(+), 14 deletions(-)
fs/nfsd/auth.c +1 -4
@@ -71,10 +71,8 @@ int nfsd_setuser(struct svc_rqst *rqstp, struct svc_export *exp)if (gid_eq (new->fsgid,INVALID_GID )) new->fsgid = exp->ex_anon_gid; - ret =set_groups (new, gi); +set_groups (new, gi);put_group_info (gi); -if (ret <0 ) - goto error;if (!uid_eq (new->fsuid,GLOBAL_ROOT_UID )) new->cap_effective =cap_drop_nfsd_set (new->cap_effective);
@@ -89,7 +87,6 @@ int nfsd_setuser(struct svc_rqst *rqstp, struct svc_export *exp) oom: ret = -ENOMEM ; -error:abort_creds (new);return ret; }
include/linux/cred.h +1 -1
@@ -66,7 +66,7 @@ extern struct group_info *groups_alloc(int);extern struct group_info init_groups;extern void groups_free (struct group_info *);extern int set_current_groups (struct group_info *); -extern int set_groups (struct cred *,struct group_info *); +extern void set_groups (struct cred *,struct group_info *);extern int groups_search (const struct group_info *,kgid_t );/* access the groups "array" with this macro */
kernel/groups.c +2 -9
@@ -161,13 +161,12 @@ int groups_search(const struct group_info *group_info, kgid_t grp)* Validate a group subscription and, if valid, insert it into a set * of credentials. */ -int set_groups (struct cred *new,struct group_info *group_info) +void set_groups (struct cred *new,struct group_info *group_info) {put_group_info (new->group_info);groups_sort (group_info);get_group_info (group_info); new->group_info = group_info; -return 0 ; }EXPORT_SYMBOL (set_groups);
@@ -182,18 +181,12 @@ EXPORT_SYMBOL(set_groups);int set_current_groups (struct group_info *group_info) {struct cred *new; -int ret; new =prepare_creds ();if (!new)return -ENOMEM ; - ret =set_groups (new, group_info); -if (ret <0 ) { -abort_creds (new); -return ret; - } - +set_groups (new, group_info);return commit_creds (new); }
Signature · 1 line
1.8.3.4.8.g69490f3.dirty
Quoted 9 lines · On Sun, 16 Feb 2014 23:31:07 +0800 Wang YanQing <[email protected]> wrote:
After commit
6307f8fee295b364716d28686df6e69c2fee751a("security: remove dead hooktask_setgroups"),set_groupswill always return zero, so we could just remove return value ofset_groups.This patch reduce code size, and simplfy code logician to use
set_groups, because we don't need to check its return value anymore.
Looks OK. We should also update the set_groups() description to reflect reality.
kernel/groups.c renamed from kernel/groups.c~kernel-groupsc-remove-return-value-of-set_groups-fix +0 -3
@@ -157,9 +157,6 @@ int groups_search(const struct group_inf* set_groups - Change a group subscription in a set of credentials * @new: The newly prepared set of credentials to alter * @group_info: The group list to install -* -* Validate a group subscription and, if valid, insert it into a set -* of credentials. */ void set_groups (struct cred *new,struct group_info *group_info) {
_