The memory allocated by kmalloc should be checked before using it.

Signed-off-by: Shen Feng <s...@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


--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to