lkml.org 
[lkml]   [2017]   [Oct]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Date
Subject[PATCH 1/5] userns: Don't special case a count of 0

We can always use a count of 1 so there is no reason to have
a special case of a count of 0.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
---
kernel/user_namespace.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/kernel/user_namespace.c b/kernel/user_namespace.c
index 5fd2d53dbc75..c9904ee084c4 100644
--- a/kernel/user_namespace.c
+++ b/kernel/user_namespace.c
@@ -232,11 +232,7 @@ static int cmp_map_id(const void *k, const void *e)
const struct idmap_key *key = k;
const struct uid_gid_extent *el = e;

- /* handle map_id_range_down() */
- if (key->count)
- id2 = key->id + key->count - 1;
- else
- id2 = key->id;
+ id2 = key->id + key->count - 1;

/* handle map_id_{down,up}() */
if (key->map_up)
@@ -362,7 +358,7 @@ static u32 map_id_down(struct uid_gid_map *map, u32 id)
if (extents <= UID_GID_MAP_MAX_BASE_EXTENTS)
return map_id_down_base(map, id);

- return map_id_range_down_max(map, id, 0);
+ return map_id_range_down_max(map, id, 1);
}

/**
@@ -404,7 +400,7 @@ static u32 map_id_up_max(struct uid_gid_map *map, u32 id)
struct idmap_key key;

key.map_up = true;
- key.count = 0;
+ key.count = 1;
key.id = id;

extents = map->nr_extents;
--
2.14.1
\
 
 \ /
  Last update: 2017-11-01 00:47    [W:0.072 / U:0.336 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site