aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChengguang Xu <cgxu519@icloud.com>2018-01-26 01:54:43 -0500
committerIlya Dryomov <idryomov@gmail.com>2018-01-29 12:36:12 -0500
commitaffff07739392920d3d2095212c72af220481b95 (patch)
tree87fc485fb0897e6c97e191b01f9e0885a86d2276
parente30ee58121e34831b9665934d70dbc72ab0fe2fb (diff)
libceph: check kstrndup() return value
Should check result of kstrndup() in case of memory allocation failure. Signed-off-by: Chengguang Xu <cgxu519@icloud.com> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
-rw-r--r--net/ceph/ceph_common.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/net/ceph/ceph_common.c b/net/ceph/ceph_common.c
index 5c036d2f401e..1e492ef2a33d 100644
--- a/net/ceph/ceph_common.c
+++ b/net/ceph/ceph_common.c
@@ -421,6 +421,10 @@ ceph_parse_options(char *options, const char *dev_name,
421 opt->name = kstrndup(argstr[0].from, 421 opt->name = kstrndup(argstr[0].from,
422 argstr[0].to-argstr[0].from, 422 argstr[0].to-argstr[0].from,
423 GFP_KERNEL); 423 GFP_KERNEL);
424 if (!opt->name) {
425 err = -ENOMEM;
426 goto out;
427 }
424 break; 428 break;
425 case Opt_secret: 429 case Opt_secret:
426 opt->key = kzalloc(sizeof(*opt->key), GFP_KERNEL); 430 opt->key = kzalloc(sizeof(*opt->key), GFP_KERNEL);