From: Geliang Tang Date: Fri, 18 Nov 2016 15:02:46 +0000 (+0800) Subject: ovl: fix return value of ovl_fill_super X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=313684c48cc0e450ab303e1f82130ee2d0b50274;p=linux-beck.git 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 Signed-off-by: Miklos Szeredi --- diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c index 7da36ccda438..20f48abbb82f 100644 --- a/fs/overlayfs/super.c +++ b/fs/overlayfs/super.c @@ -774,10 +774,12 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent) goto out_free_lowertmp; } + err = -ENOMEM; stack = kcalloc(stacklen, sizeof(struct path), GFP_KERNEL); if (!stack) goto out_free_lowertmp; + err = -EINVAL; lower = lowertmp; for (numlower = 0; numlower < stacklen; numlower++) { err = ovl_lower_dir(lower, &stack[numlower], ufs,