* [PATCH] ovl: fix return value of ovl_fill_super
@ 2016-11-18 15:02 Geliang Tang
2016-12-06 10:27 ` Miklos Szeredi
0 siblings, 1 reply; 2+ messages in thread
From: Geliang Tang @ 2016-11-18 15:02 UTC (permalink / raw)
To: Miklos Szeredi; +Cc: Geliang Tang, linux-unionfs, linux-kernel
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>
---
fs/overlayfs/super.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
index 19d31ce..1afdf77 100644
--- a/fs/overlayfs/super.c
+++ b/fs/overlayfs/super.c
@@ -754,10 +754,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,
--
2.9.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ovl: fix return value of ovl_fill_super
2016-11-18 15:02 [PATCH] ovl: fix return value of ovl_fill_super Geliang Tang
@ 2016-12-06 10:27 ` Miklos Szeredi
0 siblings, 0 replies; 2+ messages in thread
From: Miklos Szeredi @ 2016-12-06 10:27 UTC (permalink / raw)
To: Geliang Tang; +Cc: linux-unionfs, linux-kernel
On Fri, Nov 18, 2016 at 4:02 PM, Geliang Tang <geliangtang@gmail.com> wrote:
> 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().
Thanks, applied.
Miklos
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-12-06 10:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-18 15:02 [PATCH] ovl: fix return value of ovl_fill_super Geliang Tang
2016-12-06 10:27 ` Miklos Szeredi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).