lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 27 May 2020 22:11:55 +0800
From:   Kaitao Cheng <pilgrimtao@...il.com>
To:     adobriyan@...il.com
Cc:     christian@...uner.io, ebiederm@...ssion.com,
        akpm@...ux-foundation.org, gladkov.alexey@...il.com, guro@...com,
        walken@...gle.com, avagin@...il.com, khlebnikov@...dex-team.ru,
        linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
        Kaitao Cheng <pilgrimtao@...il.com>
Subject: [PATCH] proc/base: Skip assignment to len when there is no error on d_path in do_proc_readlink.

we don't need {len = PTR_ERR(pathname)} when IS_ERR(pathname) is false,
it's better to move it into if(IS_ERR(pathname)){}.

Signed-off-by: Kaitao Cheng <pilgrimtao@...il.com>
---
 fs/proc/base.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/fs/proc/base.c b/fs/proc/base.c
index d86c0afc8a85..9509e0d42610 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -1753,9 +1753,10 @@ static int do_proc_readlink(struct path *path, char __user *buffer, int buflen)
 		return -ENOMEM;
 
 	pathname = d_path(path, tmp, PAGE_SIZE);
-	len = PTR_ERR(pathname);
-	if (IS_ERR(pathname))
+	if (IS_ERR(pathname)) {
+		len = PTR_ERR(pathname);
 		goto out;
+	}
 	len = tmp + PAGE_SIZE - 1 - pathname;
 
 	if (len > buflen)
-- 
2.20.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ