57 lines
1.6 KiB
Diff
57 lines
1.6 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Casey Schaufler <casey@schaufler-ca.com>
|
|
Date: Thu, 10 May 2018 14:33:57 -0700
|
|
Subject: [PATCH] LSM: Mark security blob allocation failures as unlikely
|
|
|
|
The allocation of security blobs is unlikely to fail.
|
|
Mark the checks thus for performance reasons.
|
|
|
|
Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
|
|
---
|
|
security/security.c | 8 ++++----
|
|
1 file changed, 4 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/security/security.c b/security/security.c
|
|
index ae6ec99807ab..aeec03f49b02 100644
|
|
--- a/security/security.c
|
|
+++ b/security/security.c
|
|
@@ -1246,7 +1246,7 @@ int security_file_alloc(struct file *file)
|
|
{
|
|
int rc = lsm_file_alloc(file);
|
|
|
|
- if (rc)
|
|
+ if (unlikely(rc))
|
|
return rc;
|
|
rc = call_int_hook(file_alloc_security, 0, file);
|
|
if (unlikely(rc))
|
|
@@ -1369,7 +1369,7 @@ int security_task_alloc(struct task_struct *task, unsigned long clone_flags)
|
|
{
|
|
int rc = lsm_task_alloc(task);
|
|
|
|
- if (rc)
|
|
+ if (unlikely(rc))
|
|
return rc;
|
|
rc = call_int_hook(task_alloc, 0, task, clone_flags);
|
|
if (unlikely(rc))
|
|
@@ -1389,7 +1389,7 @@ int security_cred_alloc_blank(struct cred *cred, gfp_t gfp)
|
|
{
|
|
int rc = lsm_cred_alloc(cred, gfp);
|
|
|
|
- if (rc)
|
|
+ if (unlikely(rc))
|
|
return rc;
|
|
|
|
rc = call_int_hook(cred_alloc_blank, 0, cred, gfp);
|
|
@@ -1417,7 +1417,7 @@ int security_prepare_creds(struct cred *new, const struct cred *old, gfp_t gfp)
|
|
{
|
|
int rc = lsm_cred_alloc(new, gfp);
|
|
|
|
- if (rc)
|
|
+ if (unlikely(rc))
|
|
return rc;
|
|
|
|
rc = call_int_hook(cred_prepare, 0, new, old, gfp);
|
|
--
|
|
https://clearlinux.org
|
|
|