[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250820092848.534-1-huhai@kylinos.cn>
Date: Wed, 20 Aug 2025 17:28:48 +0800
From: huhai <hhtracer@...il.com>
To: miklos@...redi.hu,
amir73il@...il.com
Cc: linux-unionfs@...r.kernel.org,
linux-kernel@...r.kernel.org,
huhai <huhai@...inos.cn>
Subject: [PATCH] ovl: only assign err on error path
In ovl_get_upper(), the result of clone_private_mount() was
unconditionally assigned to 'err' using PTR_ERR(), even when the
returned 'upper_mnt' was valid. This assignment is unnecessary in
the success path and can be avoided.
Move the 'err = PTR_ERR(upper_mnt)' assignment inside the
IS_ERR(upper_mnt) branch so that 'err' is only set when an
error actually occurred.
No functional change intended.
Signed-off-by: huhai <huhai@...inos.cn>
---
fs/overlayfs/super.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
index df85a76597e9..a29ce0bce6a5 100644
--- a/fs/overlayfs/super.c
+++ b/fs/overlayfs/super.c
@@ -512,9 +512,9 @@ static int ovl_get_upper(struct super_block *sb, struct ovl_fs *ofs,
goto out;
upper_mnt = clone_private_mount(upperpath);
- err = PTR_ERR(upper_mnt);
if (IS_ERR(upper_mnt)) {
pr_err("failed to clone upperpath\n");
+ err = PTR_ERR(upper_mnt);
goto out;
}
--
2.40.1
Powered by blists - more mailing lists