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-prev] [day] [month] [year] [list]
Message-Id: <20221221133740.fec49a9b2be29702d10ddca7@linux-foundation.org>
Date:   Wed, 21 Dec 2022 13:37:40 -0800
From:   Andrew Morton <akpm@...ux-foundation.org>
To:     XU pengfei <xupengfei@...china.com>
Cc:     keescook@...omium.org, brauner@...nel.org,
        linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/1] hfsplus: Remove unnecessary variable initialization

On Wed, 21 Dec 2022 11:21:20 +0800 XU pengfei <xupengfei@...china.com> wrote:

> Variables are assigned first and then used. Initialization is not required.

Looks good to me.

When making such changes I suggest you also look for opportunities to
narrow the scope of the affected variables.  It makes the code easier
to read and to review.

ie,

--- a/fs/hfsplus/xattr.c~hfsplus-remove-unnecessary-variable-initialization-fix
+++ a/fs/hfsplus/xattr.c
@@ -677,7 +677,6 @@ ssize_t hfsplus_listxattr(struct dentry
 	ssize_t res;
 	struct inode *inode = d_inode(dentry);
 	struct hfs_find_data fd;
-	u16 key_len;
 	struct hfsplus_attr_key attr_key;
 	char *strbuf;
 	int xattr_name_len;
@@ -719,7 +718,8 @@ ssize_t hfsplus_listxattr(struct dentry
 	}
 
 	for (;;) {
-		key_len = hfs_bnode_read_u16(fd.bnode, fd.keyoffset);
+		u16 key_len = hfs_bnode_read_u16(fd.bnode, fd.keyoffset);
+
 		if (key_len == 0 || key_len > fd.tree->max_key_len) {
 			pr_err("invalid xattr key length: %d\n", key_len);
 			res = -EIO;
_

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ