mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-04-18 20:28:02 +07:00
ext4: clean up ext4_xattr_list()'s error code checking and return strategy
Any time you see code that tries to add error codes together, you should want to claw your eyes out... Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
This commit is contained in:
parent
9325963667
commit
eaeef86718
@ -427,23 +427,23 @@ ext4_xattr_ibody_list(struct dentry *dentry, char *buffer, size_t buffer_size)
|
|||||||
static int
|
static int
|
||||||
ext4_xattr_list(struct dentry *dentry, char *buffer, size_t buffer_size)
|
ext4_xattr_list(struct dentry *dentry, char *buffer, size_t buffer_size)
|
||||||
{
|
{
|
||||||
int i_error, b_error;
|
int ret, ret2;
|
||||||
|
|
||||||
down_read(&EXT4_I(dentry->d_inode)->xattr_sem);
|
down_read(&EXT4_I(dentry->d_inode)->xattr_sem);
|
||||||
i_error = ext4_xattr_ibody_list(dentry, buffer, buffer_size);
|
ret = ret2 = ext4_xattr_ibody_list(dentry, buffer, buffer_size);
|
||||||
if (i_error < 0) {
|
if (ret < 0)
|
||||||
b_error = 0;
|
goto errout;
|
||||||
} else {
|
|
||||||
if (buffer) {
|
if (buffer) {
|
||||||
buffer += i_error;
|
buffer += ret;
|
||||||
buffer_size -= i_error;
|
buffer_size -= ret;
|
||||||
}
|
|
||||||
b_error = ext4_xattr_block_list(dentry, buffer, buffer_size);
|
|
||||||
if (b_error < 0)
|
|
||||||
i_error = 0;
|
|
||||||
}
|
}
|
||||||
|
ret = ext4_xattr_block_list(dentry, buffer, buffer_size);
|
||||||
|
if (ret < 0)
|
||||||
|
goto errout;
|
||||||
|
ret += ret2;
|
||||||
|
errout:
|
||||||
up_read(&EXT4_I(dentry->d_inode)->xattr_sem);
|
up_read(&EXT4_I(dentry->d_inode)->xattr_sem);
|
||||||
return i_error + b_error;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user