ovl: fix return value of ovl_fill_super

If kcalloc() failed, the return value of ovl_fill_super() is -EINVAL,
not -ENOMEM. So this patch sets this value to -ENOMEM before calling
kcalloc(), and sets it back to -EINVAL after calling kcalloc().

Signed-off-by: Geliang Tang <geliangtang@gmail.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
This commit is contained in:
Geliang Tang 2016-11-18 23:02:46 +08:00 коммит произвёл Miklos Szeredi
Родитель 32a3d848eb
Коммит 313684c48c
1 изменённых файлов: 2 добавлений и 0 удалений

Просмотреть файл

@ -774,10 +774,12 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent)
goto out_free_lowertmp; goto out_free_lowertmp;
} }
err = -ENOMEM;
stack = kcalloc(stacklen, sizeof(struct path), GFP_KERNEL); stack = kcalloc(stacklen, sizeof(struct path), GFP_KERNEL);
if (!stack) if (!stack)
goto out_free_lowertmp; goto out_free_lowertmp;
err = -EINVAL;
lower = lowertmp; lower = lowertmp;
for (numlower = 0; numlower < stacklen; numlower++) { for (numlower = 0; numlower < stacklen; numlower++) {
err = ovl_lower_dir(lower, &stack[numlower], ufs, err = ovl_lower_dir(lower, &stack[numlower], ufs,