* [PATCH] landlock: Remove unnecessary conditionals
@ 2022-09-08 19:02 Jingyu Wang
2022-09-26 10:44 ` Mickaël Salaün
0 siblings, 1 reply; 2+ messages in thread
From: Jingyu Wang @ 2022-09-08 19:02 UTC (permalink / raw)
To: mic, paul, jmorris, serge
Cc: linux-security-module, linux-kernel, Jingyu Wang
iput() has already handled null and non-null parameter, so it is no
need to use if().
Signed-off-by: Jingyu Wang <jingyuwang_vip@163.com>
---
security/landlock/fs.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/security/landlock/fs.c b/security/landlock/fs.c
index 6121e9834961..3d0a8a418ce4 100644
--- a/security/landlock/fs.c
+++ b/security/landlock/fs.c
@@ -1009,8 +1009,7 @@ static void hook_sb_delete(struct super_block *const sb)
spin_unlock(&sb->s_inode_list_lock);
/* Puts the inode reference from the last loop walk, if any. */
- if (prev_inode)
- iput(prev_inode);
+ iput(prev_inode);
/* Waits for pending iput() in release_inode(). */
wait_var_event(&landlock_superblock(sb)->inode_refs,
!atomic_long_read(&landlock_superblock(sb)->inode_refs));
base-commit: 5957ac6635a1a12d4aa2661bbf04d3085a73372a
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] landlock: Remove unnecessary conditionals
2022-09-08 19:02 [PATCH] landlock: Remove unnecessary conditionals Jingyu Wang
@ 2022-09-26 10:44 ` Mickaël Salaün
0 siblings, 0 replies; 2+ messages in thread
From: Mickaël Salaün @ 2022-09-26 10:44 UTC (permalink / raw)
To: Jingyu Wang, paul, jmorris, serge; +Cc: linux-security-module, linux-kernel
Thanks for the review. I agree that this condition is optional but it
makes the code less error prone, more consistent, easier to read, and
avoids jumping to an external function. I then don't think this minor
change is worth it.
On 08/09/2022 21:02, Jingyu Wang wrote:
> iput() has already handled null and non-null parameter, so it is no
> need to use if().
>
> Signed-off-by: Jingyu Wang <jingyuwang_vip@163.com>
> ---
> security/landlock/fs.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/security/landlock/fs.c b/security/landlock/fs.c
> index 6121e9834961..3d0a8a418ce4 100644
> --- a/security/landlock/fs.c
> +++ b/security/landlock/fs.c
> @@ -1009,8 +1009,7 @@ static void hook_sb_delete(struct super_block *const sb)
> spin_unlock(&sb->s_inode_list_lock);
>
> /* Puts the inode reference from the last loop walk, if any. */
> - if (prev_inode)
> - iput(prev_inode);
> + iput(prev_inode);
> /* Waits for pending iput() in release_inode(). */
> wait_var_event(&landlock_superblock(sb)->inode_refs,
> !atomic_long_read(&landlock_superblock(sb)->inode_refs));
>
> base-commit: 5957ac6635a1a12d4aa2661bbf04d3085a73372a
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-09-26 11:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-08 19:02 [PATCH] landlock: Remove unnecessary conditionals Jingyu Wang
2022-09-26 10:44 ` Mickaël Salaün
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.