[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-id: <1516949683-127606-1-git-send-email-cgxu519@icloud.com>
Date: Fri, 26 Jan 2018 14:54:43 +0800
From: Chengguang Xu <cgxu519@...oud.com>
To: ceph-devel@...r.kernel.org
Cc: zyan@...hat.com, sage@...hat.com, davem@...emloft.net,
idryomov@...il.com, netdev@...r.kernel.org,
Chengguang Xu <cgxu519@...oud.com>
Subject: [PATCH] ceph: Check memory allocation result
Should check result of kstrndup() in case of memory allocation failure.
Signed-off-by: Chengguang Xu <cgxu519@...oud.com>
---
net/ceph/ceph_common.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/net/ceph/ceph_common.c b/net/ceph/ceph_common.c
index 5c036d2..1e492ef 100644
--- a/net/ceph/ceph_common.c
+++ b/net/ceph/ceph_common.c
@@ -421,6 +421,10 @@ struct ceph_options *
opt->name = kstrndup(argstr[0].from,
argstr[0].to-argstr[0].from,
GFP_KERNEL);
+ if (!opt->name) {
+ err = -ENOMEM;
+ goto out;
+ }
break;
case Opt_secret:
opt->key = kzalloc(sizeof(*opt->key), GFP_KERNEL);
--
1.8.3.1
Powered by blists - more mailing lists