There are some places should return -EINVAL instead of -ENOMEM in
ovl_fill_super().
[Amir] Consistently set error before checking the error condition.
Signed-off-by: Chengguang Xu <cgxu519@mykernel.net>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
        if (!ofs)
                goto out;
 
+       err = -ENOMEM;
        ofs->creator_cred = cred = prepare_creds();
        if (!cred)
                goto out_err;
        if (!splitlower)
                goto out_err;
 
+       err = -EINVAL;
        numlower = ovl_split_lowerdirs(splitlower);
        if (numlower > OVL_MAX_STACK) {
                pr_err("too many lower directories, limit is %d\n",
                goto out_err;
        }
 
+       err = -ENOMEM;
        layers = kcalloc(numlower + 1, sizeof(struct ovl_layer), GFP_KERNEL);
        if (!layers)
                goto out_err;
        if (ofs->config.upperdir) {
                struct super_block *upper_sb;
 
+               err = -EINVAL;
                if (!ofs->config.workdir) {
                        pr_err("missing 'workdir'\n");
                        goto out_err;