提交 affff077 编写于 作者: C Chengguang Xu 提交者: Ilya Dryomov

libceph: check kstrndup() return value

Should check result of kstrndup() in case of memory allocation failure.
Signed-off-by: NChengguang Xu <cgxu519@icloud.com>
Signed-off-by: NIlya Dryomov <idryomov@gmail.com>
上级 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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册