--- d3f722d20f9c6e8d849693a1754b616d3ba74bea +++ fce71981384f49873035e84c7b9f94da94168fcd @@ -182,11 +182,14 @@ static int alloc_pidmap(struct pid_names return -1; } -int next_pidmap(struct pid_namespace *pid_ns, int last) +int next_pidmap(struct pid_namespace *pid_ns, unsigned int last) { int offset; struct pidmap *map, *end; + if (last >= PID_MAX_LIMIT) + return -1; + offset = (last + 1) & BITS_PER_PAGE_MASK; map = &pid_ns->pidmap[(last + 1)/BITS_PER_PAGE]; end = &pid_ns->pidmap[PIDMAP_ENTRIES];