From: Sanidhya Kashyap <sanidhya.gatech@gmail.com>
To: dedekind1@gmail.com, adrian.hunter@intel.com,
linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org
Cc: taesoo@gatech.edu, sanidhya@gatech.edu,
Sanidhya Kashyap <sanidhya.gatech@gmail.com>,
blee@gatech.edu, csong84@gatech.edu, changwoo@gatech.edu
Subject: [PATCH] ubifs: propagate error value than 0
Date: Mon, 23 Mar 2015 10:52:57 -0400 [thread overview]
Message-ID: <1427122377-26332-1-git-send-email-sanidhya.gatech@gmail.com> (raw)
Currently, ubifs_readpage only returns 0 even if ubifs_bulk_read()
fails. Therefore propagating error to the above functions which
have called ubifs_readpage.
Another check that is missing is ENOMEM for kmalloc in ubifs_bulk_read.
Signed-off-by: Sanidhya Kashyap <sanidhya.gatech@gmail.com>
---
fs/ubifs/file.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c
index e627c0a..b2d1de0 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,8 +889,11 @@ 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;
--
2.1.0
reply other threads:[~2015-03-23 14:53 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1427122377-26332-1-git-send-email-sanidhya.gatech@gmail.com \
--to=sanidhya.gatech@gmail.com \
--cc=adrian.hunter@intel.com \
--cc=blee@gatech.edu \
--cc=changwoo@gatech.edu \
--cc=csong84@gatech.edu \
--cc=dedekind1@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=sanidhya@gatech.edu \
--cc=taesoo@gatech.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).