diff options
author | Chengguang Xu <cgxu519@icloud.com> | 2018-01-26 09:54:43 +0300 |
---|---|---|
committer | Ilya Dryomov <idryomov@gmail.com> | 2018-01-29 20:36:12 +0300 |
commit | affff07739392920d3d2095212c72af220481b95 (patch) | |
tree | 87fc485fb0897e6c97e191b01f9e0885a86d2276 /net/ceph/ceph_common.c | |
parent | e30ee58121e34831b9665934d70dbc72ab0fe2fb (diff) | |
download | linux-affff07739392920d3d2095212c72af220481b95.tar.xz |
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>
Diffstat (limited to 'net/ceph/ceph_common.c')
-rw-r--r-- | net/ceph/ceph_common.c | 4 |
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, 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); |