From 8d64124a6a93ec68fda6f781e48a7b95d9dd17d9 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Mon, 10 Dec 2018 15:34:12 -0500 Subject: [PATCH] selinux; don't open-code a loop in sb_finish_set_opts() Reviewed-by: David Howells Signed-off-by: Al Viro --- security/selinux/hooks.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index 59b164d7134d..630fe8883957 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c @@ -571,10 +571,9 @@ static int sb_finish_set_opts(struct super_block *sb) during get_sb by a pseudo filesystem that directly populates itself. */ spin_lock(&sbsec->isec_lock); -next_inode: - if (!list_empty(&sbsec->isec_head)) { + while (!list_empty(&sbsec->isec_head)) { struct inode_security_struct *isec = - list_entry(sbsec->isec_head.next, + list_first_entry(&sbsec->isec_head, struct inode_security_struct, list); struct inode *inode = isec->inode; list_del_init(&isec->list); @@ -586,7 +585,6 @@ static int sb_finish_set_opts(struct super_block *sb) iput(inode); } spin_lock(&sbsec->isec_lock); - goto next_inode; } spin_unlock(&sbsec->isec_lock); out: