From: Shen Feng <shen@cn.fujitsu.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH] Btrfs: check return of kmalloc in btrfs_control_ioctl
Date: Mon, 29 Dec 2008 11:43:39 +0800 [thread overview]
Message-ID: <4958476B.5090105@cn.fujitsu.com> (raw)
The memory allocated by kmalloc should be checked before using it.
Signed-off-by: Shen Feng <shen@cn.fujitsu.com>
---
fs/btrfs/super.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 84c3b66..d0e8dce 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -590,6 +590,8 @@ static long btrfs_control_ioctl(struct file *file, unsigned int cmd,
int len;
vol = kmalloc(sizeof(*vol), GFP_KERNEL);
+ if (!vol)
+ return -ENOMEM;
if (copy_from_user(vol, (void __user *)arg, sizeof(*vol))) {
ret = -EFAULT;
goto out;
--
1.6.0.6
reply other threads:[~2008-12-29 3:43 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=4958476B.5090105@cn.fujitsu.com \
--to=shen@cn.fujitsu.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox