lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Tue, 15 Apr 2008 12:12:48 +0900 From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com> To: Andrew Morton <akpm@...ux-foundation.org> Cc: Li Zefan <lizf@...fujitsu.com>, "balbir@...ux.vnet.ibm.com" <balbir@...ux.vnet.ibm.com>, "xemul@...nvz.org" <xemul@...nvz.org>, menage@...gle.com, "linux-mm@...ck.org" <linux-mm@...ck.org>, LKML <linux-kernel@...r.kernel.org> Subject: Re: [PATCH] use vmalloc for mem_cgroup allocation. v2 On Mon, 14 Apr 2008 19:20:42 -0700 Andrew Morton <akpm@...ux-foundation.org> wrote: > On Tue, 15 Apr 2008 10:08:25 +0800 Li Zefan <lizf@...fujitsu.com> wrote: > > > > @@ -992,8 +993,10 @@ mem_cgroup_create(struct cgroup_subsys * > > > if (unlikely((cont->parent) == NULL)) { > > > mem = &init_mem_cgroup; > > > page_cgroup_cache = KMEM_CACHE(page_cgroup, SLAB_PANIC); > > > - } else > > > - mem = kzalloc(sizeof(struct mem_cgroup), GFP_KERNEL); > > > + } else { > > > + mem = vmalloc(sizeof(struct mem_cgroup)); > > > + memset(mem, 0, sizeof(*mem)); > > > > what if mem == NULL. ;) > > > > > + } > > > > > > if (mem == NULL) > > > return ERR_PTR(-ENOMEM); > > > > So we can move this NULL check to the above else branch, in the if brach, > > mem won't be NULL. > > err, yes. > > So I have: > > if (unlikely((cont->parent) == NULL)) { > mem = &init_mem_cgroup; > page_cgroup_cache = KMEM_CACHE(page_cgroup, SLAB_PANIC); > } else { > mem = vmalloc(sizeof(struct mem_cgroup)); > if (mem == NULL) > return ERR_PTR(-ENOMEM); > memset(mem, 0, sizeof(*mem)); > } > Sorry for poor patch.... And thank you for catching. Thanks, -Kame -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@...r.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists