[PATCH] kernel/groups: groups_search can be boolean
From: tangzhongrui
Date: Fri Dec 15 2017 - 01:44:04 EST
This patch makes groups_search return bool due to this
particular function only using either one or zero as its return
value.
No functional change.
Signed-off-by: tangzhongrui <tangzhongrui@xxxxxxxxxxxxxxxxxxxx>
---
include/linux/cred.h | 2 +-
kernel/groups.c | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/include/linux/cred.h b/include/linux/cred.h
index 099058e..c3eb950 100644
--- a/include/linux/cred.h
+++ b/include/linux/cred.h
@@ -81,7 +81,7 @@ static inline int in_egroup_p(kgid_t grp)
#endif
extern int set_current_groups(struct group_info *);
extern void set_groups(struct cred *, struct group_info *);
-extern int groups_search(const struct group_info *, kgid_t);
+extern bool groups_search(const struct group_info *, kgid_t);
extern bool may_setgroups(void);
/*
diff --git a/kernel/groups.c b/kernel/groups.c
index e357bc8..c1b5d86 100644
--- a/kernel/groups.c
+++ b/kernel/groups.c
@@ -93,12 +93,12 @@ static void groups_sort(struct group_info *group_info)
}
/* a simple bsearch */
-int groups_search(const struct group_info *group_info, kgid_t grp)
+bool groups_search(const struct group_info *group_info, kgid_t grp)
{
unsigned int left, right;
if (!group_info)
- return 0;
+ return false;
left = 0;
right = group_info->ngroups;
@@ -109,9 +109,9 @@ int groups_search(const struct group_info *group_info, kgid_t grp)
else if (gid_lt(grp, group_info->gid[mid]))
right = mid;
else
- return 1;
+ return true;
}
- return 0;
+ return false;
}
/**
--
1.8.3.1