All of lore.kernel.org
 help / color / mirror / Atom feed
From: "JieJing.Zhang" <kzjeef@gmail.com>
To: linux-btrfs@vger.kernel.org
Cc: "JieJing.Zhang" <kzjeef@gmail.com>
Subject: [PATCH] Btrfs: handle kmalloc() failure in btrfs_file_aio_write()
Date: Sun, 20 Jun 2010 02:13:14 +0800	[thread overview]
Message-ID: <1276971194-24572-1-git-send-email-kzjeef@gmail.com> (raw)

set errno to -ENOMEM and goto out

Signed-off-by: JieJing.Zhang <kzjeef@gmail.com>
---
 fs/btrfs/file.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index e354c33..e0fcb6c 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -926,6 +926,10 @@ static ssize_t btrfs_file_aio_write(struct kiocb *iocb,
 		     PAGE_CACHE_SIZE, PAGE_CACHE_SIZE /
 		     (sizeof(struct page *)));
 	pages = kmalloc(nrptrs * sizeof(struct page *), GFP_KERNEL);
+	if (!pages) {
+		ret = -ENOMEM;
+		goto out;
+	}
 
 	/* generic_write_checks can change our pos */
 	start_pos = pos;
-- 
1.7.0.4


             reply	other threads:[~2010-06-19 18:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-19 18:13 JieJing.Zhang [this message]
2010-06-20  4:56 ` [PATCH] Btrfs: handle kmalloc() failure in btrfs_file_aio_write() Zhang JieJing
2010-07-03 17:35   ` Zhang JieJing

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=1276971194-24572-1-git-send-email-kzjeef@gmail.com \
    --to=kzjeef@gmail.com \
    --cc=linux-btrfs@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.