lkml.org 
[lkml]   [2017]   [Dec]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] kernel/groups: groups_search can be boolean
Date
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@cmss.chinamobile.com>
---
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


\
 
 \ /
  Last update: 2017-12-15 07:44    [W:0.024 / U:0.500 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site