linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] proc: Remove unnecessary ‘NULL’ and '0' values
@ 2022-10-08  9:30 Li zeming
  2022-10-09 15:12 ` Kees Cook
  0 siblings, 1 reply; 2+ messages in thread
From: Li zeming @ 2022-10-08  9:30 UTC (permalink / raw)
  To: mcgrof, keescook, yzaikin; +Cc: linux-kernel, linux-fsdevel, Li zeming

Remove unnecessary initialization assignments, which are used after the
assignment.

Signed-off-by: Li zeming <zeming@nfschina.com>
---
 fs/proc/proc_sysctl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
index 021e83fe831f..5fc367f0044a 100644
--- a/fs/proc/proc_sysctl.c
+++ b/fs/proc/proc_sysctl.c
@@ -694,7 +694,7 @@ static bool proc_sys_fill_cache(struct file *file,
 	struct dentry *child, *dir = file->f_path.dentry;
 	struct inode *inode;
 	struct qstr qname;
-	ino_t ino = 0;
+	ino_t ino;
 	unsigned type = DT_UNKNOWN;
 
 	qname.name = table->procname;
@@ -1246,7 +1246,7 @@ static bool get_links(struct ctl_dir *dir,
 static int insert_links(struct ctl_table_header *head)
 {
 	struct ctl_table_set *root_set = &sysctl_table_root.default_set;
-	struct ctl_dir *core_parent = NULL;
+	struct ctl_dir *core_parent;
 	struct ctl_table_header *links;
 	int err;
 
-- 
2.18.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] proc: Remove unnecessary ‘NULL’ and '0' values
  2022-10-08  9:30 [PATCH] proc: Remove unnecessary ‘NULL’ and '0' values Li zeming
@ 2022-10-09 15:12 ` Kees Cook
  0 siblings, 0 replies; 2+ messages in thread
From: Kees Cook @ 2022-10-09 15:12 UTC (permalink / raw)
  To: Li zeming; +Cc: mcgrof, yzaikin, linux-kernel, linux-fsdevel

On Sat, Oct 08, 2022 at 05:30:26PM +0800, Li zeming wrote:
> Remove unnecessary initialization assignments, which are used after the
> assignment.

They don't hurt anything, and in fact show the intent of the initial
variable state. Additionally, the compiler will drop it once it finds
the later assignment.

-Kees

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-10-09 15:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-08  9:30 [PATCH] proc: Remove unnecessary ‘NULL’ and '0' values Li zeming
2022-10-09 15:12 ` Kees Cook

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).