fdget(), more trivial conversions
all failure exits prior to fdget() leave the scope, all matching fdput() are immediately followed by leaving the scope. [xfs_ioc_commit_range() chunk moved here as well] Reviewed-by: Christian Brauner <brauner@kernel.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
@@ -283,7 +283,6 @@ enum loadpin_securityfs_interface_index {
|
||||
|
||||
static int read_trusted_verity_root_digests(unsigned int fd)
|
||||
{
|
||||
struct fd f;
|
||||
void *data;
|
||||
int rc;
|
||||
char *p, *d;
|
||||
@@ -295,8 +294,8 @@ static int read_trusted_verity_root_digests(unsigned int fd)
|
||||
if (!list_empty(&dm_verity_loadpin_trusted_root_digests))
|
||||
return -EPERM;
|
||||
|
||||
f = fdget(fd);
|
||||
if (!fd_file(f))
|
||||
CLASS(fd, f)(fd);
|
||||
if (fd_empty(f))
|
||||
return -EINVAL;
|
||||
|
||||
data = kzalloc(SZ_4K, GFP_KERNEL);
|
||||
@@ -359,7 +358,6 @@ static int read_trusted_verity_root_digests(unsigned int fd)
|
||||
}
|
||||
|
||||
kfree(data);
|
||||
fdput(f);
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -379,8 +377,6 @@ err:
|
||||
/* disallow further attempts after reading a corrupt/invalid file */
|
||||
deny_reading_verity_digests = true;
|
||||
|
||||
fdput(f);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user