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]
Message-Id: <20200612160946.21187-1-pilgrimtao@gmail.com>
Date:   Sat, 13 Jun 2020 00:09:46 +0800
From:   Kaitao Cheng <pilgrimtao@...il.com>
To:     adobriyan@...il.com, Markus.Elfring@....de
Cc:     linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
        songmuchun@...edance.com, kernel-janitors@...r.kernel.org,
        Kaitao Cheng <pilgrimtao@...il.com>
Subject: [PATCH v2] proc/fd: Remove unnecessary {files, f_flags, file} initialization in seq_show()

'files' will be immediately reassigned. 'f_flags' and 'file' will be
overwritten in the if{} or seq_show() directly exits with an error.
so we don't need to consume CPU resources to initialize them.

Signed-off-by: Kaitao Cheng <pilgrimtao@...il.com>
---

v2 ChangeLog:
  1. Fix some commit message
  2. Remove unnecessary f_flags initialization

 fs/proc/fd.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/proc/fd.c b/fs/proc/fd.c
index 81882a13212d..d3854b76e95e 100644
--- a/fs/proc/fd.c
+++ b/fs/proc/fd.c
@@ -19,9 +19,9 @@
 
 static int seq_show(struct seq_file *m, void *v)
 {
-	struct files_struct *files = NULL;
-	int f_flags = 0, ret = -ENOENT;
-	struct file *file = NULL;
+	struct files_struct *files;
+	int f_flags, ret = -ENOENT;
+	struct file *file;
 	struct task_struct *task;
 
 	task = get_proc_task(m->private);
-- 
2.20.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ