From: Amerigo Wang Date: Wed, 1 Jul 2009 05:06:26 +0000 (-0400) Subject: elf: fix one check-after-use X-Git-Tag: v2.6.30.4~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=63510144577601e1747480a250c6c01aebeb704e;p=thirdparty%2Fkernel%2Fstable.git elf: fix one check-after-use commit e2dbe12557d85d81f4527879499f55681c3cca4f upstream. Check before use it. Signed-off-by: WANG Cong Cc: Alexander Viro Cc: David Howells Acked-by: Roland McGrath Acked-by: James Morris Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index 40381df348697..605b17a7c5758 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c @@ -1518,11 +1518,11 @@ static int fill_note_info(struct elfhdr *elf, int phdrs, info->thread = NULL; psinfo = kmalloc(sizeof(*psinfo), GFP_KERNEL); - fill_note(&info->psinfo, "CORE", NT_PRPSINFO, sizeof(*psinfo), psinfo); - if (psinfo == NULL) return 0; + fill_note(&info->psinfo, "CORE", NT_PRPSINFO, sizeof(*psinfo), psinfo); + /* * Figure out how many notes we're going to need for each thread. */