* [PATCH] kernel/groups.c: remove return value of set_groups
@ 2014-02-16 15:31 Wang YanQing
2014-02-18 23:03 ` Andrew Morton
0 siblings, 1 reply; 2+ messages in thread
From: Wang YanQing @ 2014-02-16 15:31 UTC (permalink / raw)
To: akpm; +Cc: ebiederm, serge.hallyn, linux-kernel
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.
Signed-off-by: Wang YanQing <udknight@gmail.com>
---
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(-)
diff --git a/fs/nfsd/auth.c b/fs/nfsd/auth.c
index 06cddd5..2645be4 100644
--- a/fs/nfsd/auth.c
+++ b/fs/nfsd/auth.c
@@ -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;
}
diff --git a/include/linux/cred.h b/include/linux/cred.h
index 04421e8..f61d6c8 100644
--- a/include/linux/cred.h
+++ b/include/linux/cred.h
@@ -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 */
diff --git a/kernel/groups.c b/kernel/groups.c
index 90cf1c3..1ccdd28 100644
--- a/kernel/groups.c
+++ b/kernel/groups.c
@@ -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);
}
--
1.8.3.4.8.g69490f3.dirty
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] kernel/groups.c: remove return value of set_groups
2014-02-16 15:31 [PATCH] kernel/groups.c: remove return value of set_groups Wang YanQing
@ 2014-02-18 23:03 ` Andrew Morton
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2014-02-18 23:03 UTC (permalink / raw)
To: Wang YanQing; +Cc: ebiederm, serge.hallyn, linux-kernel, Eric Paris
On Sun, 16 Feb 2014 23:31:07 +0800 Wang YanQing <udknight@gmail.com> wrote:
> 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.
>
Looks OK. We should also update the set_groups() description to
reflect reality.
--- a/kernel/groups.c~kernel-groupsc-remove-return-value-of-set_groups-fix
+++ a/kernel/groups.c
@@ -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)
{
_
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-02-18 23:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-16 15:31 [PATCH] kernel/groups.c: remove return value of set_groups Wang YanQing
2014-02-18 23:03 ` Andrew Morton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox