lkml.org 
[lkml]   [2023]   [Dec]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v39 28/42] LSM: Improve logic in security_getprocattr
Date
The conditional in security_getprocattr() can be simplified
and made clearer. This change does that.

Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
---
security/security.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/security/security.c b/security/security.c
index 8ff6cef26e6c..f2ef6032a925 100644
--- a/security/security.c
+++ b/security/security.c
@@ -4107,11 +4107,10 @@ int security_getprocattr(struct task_struct *p, int lsmid, const char *name,
{
struct security_hook_list *hp;

- hlist_for_each_entry(hp, &security_hook_heads.getprocattr, list) {
- if (lsmid != 0 && lsmid != hp->lsmid->id)
- continue;
- return hp->hook.getprocattr(p, name, value);
- }
+ hlist_for_each_entry(hp, &security_hook_heads.getprocattr, list)
+ if (lsmid == LSM_ID_UNDEF || lsmid == hp->lsmid->id)
+ return hp->hook.getprocattr(p, name, value);
+
return LSM_RET_DEFAULT(getprocattr);
}

--
2.41.0

\
 
 \ /
  Last update: 2023-12-15 23:39    [W:1.369 / U:0.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site