Commit affff077 authored by Chengguang Xu's avatar Chengguang Xu Committed by Ilya Dryomov

libceph: check kstrndup() return value

Should check result of kstrndup() in case of memory allocation failure.
Signed-off-by: default avatarChengguang Xu <cgxu519@icloud.com>
Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
parent e30ee581
...@@ -421,6 +421,10 @@ ceph_parse_options(char *options, const char *dev_name, ...@@ -421,6 +421,10 @@ ceph_parse_options(char *options, const char *dev_name,
opt->name = kstrndup(argstr[0].from, opt->name = kstrndup(argstr[0].from,
argstr[0].to-argstr[0].from, argstr[0].to-argstr[0].from,
GFP_KERNEL); GFP_KERNEL);
if (!opt->name) {
err = -ENOMEM;
goto out;
}
break; break;
case Opt_secret: case Opt_secret:
opt->key = kzalloc(sizeof(*opt->key), GFP_KERNEL); opt->key = kzalloc(sizeof(*opt->key), GFP_KERNEL);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment