From patchwork Mon Dec 2 10:37:05 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhouyi Zhou X-Patchwork-Id: 295866 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from casper.infradead.org (unknown [IPv6:2001:770:15f::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id B613F2C0087 for ; Mon, 2 Dec 2013 21:38:05 +1100 (EST) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VnQsy-0003F0-Ta; Mon, 02 Dec 2013 10:37:53 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VnQsx-0000v0-9e; Mon, 02 Dec 2013 10:37:51 +0000 Received: from mail-pb0-x229.google.com ([2607:f8b0:400e:c01::229]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VnQst-0000uB-Sc for linux-mtd@lists.infradead.org; Mon, 02 Dec 2013 10:37:49 +0000 Received: by mail-pb0-f41.google.com with SMTP id jt11so18738569pbb.0 for ; Mon, 02 Dec 2013 02:37:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=XgeEeBZSWMW2zrTQeGmuhN0Yo4VsOplWG3h698CuT1Y=; b=X7UeRZattXA2JKk96wS8zerDkwtzhtU754F8pDruGcCvlZ+83KKkKXuTtna5Zr/sTY NhBKmWKLQLtkqIro4JkStmcpTgNIyOGWXLq/Qv5r7Vx1cQaHGia1o59FBL5LgROOxQN2 y6+WNPcifTsWLAyTgoZ155SvMckVEGQZfwZzzyv/RhliPNa8A4wnKiClEFlO1tD6ISWA 02YAqTUm84b3Eo/4pJcnR/JYmuJEHQlyyrYa5bf2zdcPZtVa4LtGS56IvJLZlL4W6rrg 6qvD+v3bNk+8cj6/TCX/O8VcyUyQMGM2xt3ljX6j91QFUdhYR337JZ9ZIVgAM1RR3dPW IWxQ== X-Received: by 10.66.184.168 with SMTP id ev8mr2669561pac.152.1385980645032; Mon, 02 Dec 2013 02:37:25 -0800 (PST) Received: from localhost.localdomain ([159.226.43.61]) by mx.google.com with ESMTPSA id lh13sm29304895pab.4.2013.12.02.02.37.22 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 02 Dec 2013 02:37:24 -0800 (PST) From: Zhouyi Zhou To: , , Subject: [PATCH] JFFS2: NULL return of kmem_cache_zalloc should be handled. Date: Mon, 2 Dec 2013 18:37:05 +0800 Message-Id: <1385980625-26545-1-git-send-email-yizhouzhou@ict.ac.cn> X-Mailer: git-send-email 1.7.10.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131202_053748_008910_F42C8095 X-CRM114-Status: UNSURE ( 7.31 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.0 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (zhouzhouyi[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: Zhouyi Zhou X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org NULL return of kmem_cache_zalloc should be handled in jffs2_alloc_xattr_datum and jff2_alloc_xattr_ref. Signed-off-by: Zhouyi Zhou --- fs/jffs2/malloc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/jffs2/malloc.c b/fs/jffs2/malloc.c index 4f47aa2..b8fd651 100644 --- a/fs/jffs2/malloc.c +++ b/fs/jffs2/malloc.c @@ -288,6 +288,8 @@ struct jffs2_xattr_datum *jffs2_alloc_xattr_datum(void) struct jffs2_xattr_datum *xd; xd = kmem_cache_zalloc(xattr_datum_cache, GFP_KERNEL); dbg_memalloc("%p\n", xd); + if (!xd) + return NULL; xd->class = RAWNODE_CLASS_XATTR_DATUM; xd->node = (void *)xd; @@ -306,6 +308,8 @@ struct jffs2_xattr_ref *jffs2_alloc_xattr_ref(void) struct jffs2_xattr_ref *ref; ref = kmem_cache_zalloc(xattr_ref_cache, GFP_KERNEL); dbg_memalloc("%p\n", ref); + if (!ref) + return NULL; ref->class = RAWNODE_CLASS_XATTR_REF; ref->node = (void *)ref;