Commit 78479816 authored by Linus Torvalds's avatar Linus Torvalds

Fix gidsetsize == 0 for real this time.

We need to always allocate at least one indirect block
pointer, since we always fill out blocks[0] even if
we don't have any groups.
parent 584286cc
......@@ -1126,8 +1126,9 @@ struct group_info *groups_alloc(int gidsetsize)
int i;
nblocks = (gidsetsize + NGROUPS_PER_BLOCK - 1) / NGROUPS_PER_BLOCK;
group_info = kmalloc(sizeof(*group_info) + nblocks*sizeof(gid_t *),
GFP_USER);
/* Make sure we always allocate at least one indirect block pointer */
nblocks = nblocks ? : 1;
group_info = kmalloc(sizeof(*group_info) + nblocks*sizeof(gid_t *), GFP_USER);
if (!group_info)
return NULL;
group_info->ngroups = gidsetsize;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment