mirror of
https://github.com/fail0verflow/switch-linux.git
synced 2025-05-04 02:34:21 -04:00
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>
This commit is contained in:
parent
e30ee58121
commit
affff07739
1 changed files with 4 additions and 0 deletions
|
@ -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);
|
||||||
|
|
Loading…
Add table
Reference in a new issue