diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2017-10-31 16:54:32 -0400 |
---|---|---|
committer | Eric W. Biederman <ebiederm@xmission.com> | 2017-10-31 18:23:11 -0400 |
commit | 11a8b9270e16e36d5fb607ba4b60db2958b7c625 (patch) | |
tree | 82ba6ad20d0ffdb4907035d809c712ca13b0910c /kernel/user_namespace.c | |
parent | 6397fac4915ab3002dc15aae751455da1a852f25 (diff) |
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>
Diffstat (limited to 'kernel/user_namespace.c')
-rw-r--r-- | kernel/user_namespace.c | 10 |
1 files 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) | |||
232 | const struct idmap_key *key = k; | 232 | const struct idmap_key *key = k; |
233 | const struct uid_gid_extent *el = e; | 233 | const struct uid_gid_extent *el = e; |
234 | 234 | ||
235 | /* handle map_id_range_down() */ | 235 | id2 = key->id + key->count - 1; |
236 | if (key->count) | ||
237 | id2 = key->id + key->count - 1; | ||
238 | else | ||
239 | id2 = key->id; | ||
240 | 236 | ||
241 | /* handle map_id_{down,up}() */ | 237 | /* handle map_id_{down,up}() */ |
242 | if (key->map_up) | 238 | if (key->map_up) |
@@ -362,7 +358,7 @@ static u32 map_id_down(struct uid_gid_map *map, u32 id) | |||
362 | if (extents <= UID_GID_MAP_MAX_BASE_EXTENTS) | 358 | if (extents <= UID_GID_MAP_MAX_BASE_EXTENTS) |
363 | return map_id_down_base(map, id); | 359 | return map_id_down_base(map, id); |
364 | 360 | ||
365 | return map_id_range_down_max(map, id, 0); | 361 | return map_id_range_down_max(map, id, 1); |
366 | } | 362 | } |
367 | 363 | ||
368 | /** | 364 | /** |
@@ -404,7 +400,7 @@ static u32 map_id_up_max(struct uid_gid_map *map, u32 id) | |||
404 | struct idmap_key key; | 400 | struct idmap_key key; |
405 | 401 | ||
406 | key.map_up = true; | 402 | key.map_up = true; |
407 | key.count = 0; | 403 | key.count = 1; |
408 | key.id = id; | 404 | key.id = id; |
409 | 405 | ||
410 | extents = map->nr_extents; | 406 | extents = map->nr_extents; |