Commit 1b2fde2d authored by XU pengfei's avatar XU pengfei Committed by Andrew Morton

hfsplus: remove unnecessary variable initialization

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

[akpm@linux-foundation.org: give hfsplus_listxattr:key_len narrower scope]
Link: https://lkml.kernel.org/r/20221221032119.10037-1-xupengfei@nfschina.comSigned-off-by: default avatarXU pengfei <xupengfei@nfschina.com>
Reviewed-by: default avatarAndrew Morton <akpm@linux-foudation.org>
Cc: Christian Brauner <brauner@kernel.org>
Cc: Kees Cook <keescook@chromium.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent d5528cc1
...@@ -257,7 +257,7 @@ static int hfsplus_create_attributes_file(struct super_block *sb) ...@@ -257,7 +257,7 @@ static int hfsplus_create_attributes_file(struct super_block *sb)
int __hfsplus_setxattr(struct inode *inode, const char *name, int __hfsplus_setxattr(struct inode *inode, const char *name,
const void *value, size_t size, int flags) const void *value, size_t size, int flags)
{ {
int err = 0; int err;
struct hfs_find_data cat_fd; struct hfs_find_data cat_fd;
hfsplus_cat_entry entry; hfsplus_cat_entry entry;
u16 cat_entry_flags, cat_entry_type; u16 cat_entry_flags, cat_entry_type;
...@@ -494,7 +494,7 @@ ssize_t __hfsplus_getxattr(struct inode *inode, const char *name, ...@@ -494,7 +494,7 @@ ssize_t __hfsplus_getxattr(struct inode *inode, const char *name,
__be32 xattr_record_type; __be32 xattr_record_type;
u32 record_type; u32 record_type;
u16 record_length = 0; u16 record_length = 0;
ssize_t res = 0; ssize_t res;
if ((!S_ISREG(inode->i_mode) && if ((!S_ISREG(inode->i_mode) &&
!S_ISDIR(inode->i_mode)) || !S_ISDIR(inode->i_mode)) ||
...@@ -606,7 +606,7 @@ static inline int can_list(const char *xattr_name) ...@@ -606,7 +606,7 @@ static inline int can_list(const char *xattr_name)
static ssize_t hfsplus_listxattr_finder_info(struct dentry *dentry, static ssize_t hfsplus_listxattr_finder_info(struct dentry *dentry,
char *buffer, size_t size) char *buffer, size_t size)
{ {
ssize_t res = 0; ssize_t res;
struct inode *inode = d_inode(dentry); struct inode *inode = d_inode(dentry);
struct hfs_find_data fd; struct hfs_find_data fd;
u16 entry_type; u16 entry_type;
...@@ -674,10 +674,9 @@ static ssize_t hfsplus_listxattr_finder_info(struct dentry *dentry, ...@@ -674,10 +674,9 @@ static ssize_t hfsplus_listxattr_finder_info(struct dentry *dentry,
ssize_t hfsplus_listxattr(struct dentry *dentry, char *buffer, size_t size) ssize_t hfsplus_listxattr(struct dentry *dentry, char *buffer, size_t size)
{ {
ssize_t err; ssize_t err;
ssize_t res = 0; ssize_t res;
struct inode *inode = d_inode(dentry); struct inode *inode = d_inode(dentry);
struct hfs_find_data fd; struct hfs_find_data fd;
u16 key_len = 0;
struct hfsplus_attr_key attr_key; struct hfsplus_attr_key attr_key;
char *strbuf; char *strbuf;
int xattr_name_len; int xattr_name_len;
...@@ -719,7 +718,8 @@ ssize_t hfsplus_listxattr(struct dentry *dentry, char *buffer, size_t size) ...@@ -719,7 +718,8 @@ ssize_t hfsplus_listxattr(struct dentry *dentry, char *buffer, size_t size)
} }
for (;;) { 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) { if (key_len == 0 || key_len > fd.tree->max_key_len) {
pr_err("invalid xattr key length: %d\n", key_len); pr_err("invalid xattr key length: %d\n", key_len);
res = -EIO; res = -EIO;
...@@ -766,12 +766,12 @@ ssize_t hfsplus_listxattr(struct dentry *dentry, char *buffer, size_t size) ...@@ -766,12 +766,12 @@ ssize_t hfsplus_listxattr(struct dentry *dentry, char *buffer, size_t size)
static int hfsplus_removexattr(struct inode *inode, const char *name) static int hfsplus_removexattr(struct inode *inode, const char *name)
{ {
int err = 0; int err;
struct hfs_find_data cat_fd; struct hfs_find_data cat_fd;
u16 flags; u16 flags;
u16 cat_entry_type; u16 cat_entry_type;
int is_xattr_acl_deleted = 0; int is_xattr_acl_deleted;
int is_all_xattrs_deleted = 0; int is_all_xattrs_deleted;
if (!HFSPLUS_SB(inode->i_sb)->attr_tree) if (!HFSPLUS_SB(inode->i_sb)->attr_tree)
return -EOPNOTSUPP; return -EOPNOTSUPP;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment