From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932166AbbCWFL7 (ORCPT ); Mon, 23 Mar 2015 01:11:59 -0400 Received: from mail-yh0-f68.google.com ([209.85.213.68]:33131 "EHLO mail-yh0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752406AbbCWFL6 (ORCPT ); Mon, 23 Mar 2015 01:11:58 -0400 From: Sanidhya Kashyap To: dedekind1@gmail.com, adrian.hunter@intel.com, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Cc: taesoo@gatech.edu, changwoo@gatech.edu, sanidhya@gatech.edu, blee@gatech.edu, Sanidhya Kashyap Subject: [PATCH] ubifs: return err value than 0 Date: Mon, 23 Mar 2015 01:11:34 -0400 Message-Id: <1427087494-29017-1-git-send-email-sanidhya.gatech@gmail.com> X-Mailer: git-send-email 2.1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently, ubifs_readpage only returns 0 even if ubifs_bulk_read() fails. Like the other file systems, the error value should be propagated further instead of 0. Another check that is missing is ENOMEM for kmalloc. Signed-off-by: Sanidhya Kashyap --- fs/ubifs/file.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c index e627c0a..28fe892 100644 --- a/fs/ubifs/file.c +++ b/fs/ubifs/file.c @@ -863,8 +863,10 @@ static int ubifs_bulk_read(struct page *page) bu = &c->bu; else { bu = kmalloc(sizeof(struct bu_info), GFP_NOFS | __GFP_NOWARN); - if (!bu) + if (!bu) { + err = -ENOMEM; goto out_unlock; + } bu->buf = NULL; allocated = 1; @@ -887,11 +889,14 @@ out_unlock: static int ubifs_readpage(struct file *file, struct page *page) { - if (ubifs_bulk_read(page)) - return 0; + int err = 0; + + err = ubifs_bulk_read(page); + if (err) + return err; do_readpage(page); unlock_page(page); - return 0; + return err; } static int do_writepage(struct page *page, int len) -- 2.1.0