tools headers UAPI: Sync openat2.h with the kernel sources
[linux-2.6-microblaze.git] / kernel / groups.c
index fe7e638..787b381 100644 (file)
 struct group_info *groups_alloc(int gidsetsize)
 {
        struct group_info *gi;
-       unsigned int len;
-
-       len = sizeof(struct group_info) + sizeof(kgid_t) * gidsetsize;
-       gi = kmalloc(len, GFP_KERNEL_ACCOUNT|__GFP_NOWARN|__GFP_NORETRY);
-       if (!gi)
-               gi = __vmalloc(len, GFP_KERNEL_ACCOUNT);
+       gi = kvmalloc(struct_size(gi, gid, gidsetsize), GFP_KERNEL_ACCOUNT);
        if (!gi)
                return NULL;