summaryrefslogtreecommitdiffstats
path: root/security/tomoyo/audit.c
diff options
context:
space:
mode:
authorVlastimil Babka <vbabka@suse.cz>2023-02-28 10:35:56 +0100
committerTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>2023-03-01 15:46:12 +0100
commitc120c98486c2855d2ae266c2af63d26f61dfcc4e (patch)
tree28196d06b82533e0143a66b02be2634a2e1d124a /security/tomoyo/audit.c
parentMerge tag 'xfs-6.3-merge-4' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux (diff)
downloadlinux-c120c98486c2855d2ae266c2af63d26f61dfcc4e.tar.xz
linux-c120c98486c2855d2ae266c2af63d26f61dfcc4e.zip
tomoyo: replace tomoyo_round2() with kmalloc_size_roundup()
It seems tomoyo has had its own implementation of what kmalloc_size_roundup() does today. Remove the function tomoyo_round2() and replace it with kmalloc_size_roundup(). It provides more accurate results and doesn't contain a while loop. Signed-off-by: Vlastimil Babka <vbabka@suse.cz> Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Diffstat (limited to 'security/tomoyo/audit.c')
-rw-r--r--security/tomoyo/audit.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/security/tomoyo/audit.c b/security/tomoyo/audit.c
index 7cf8fdbb29bf..610c1536cf70 100644
--- a/security/tomoyo/audit.c
+++ b/security/tomoyo/audit.c
@@ -271,7 +271,7 @@ char *tomoyo_init_log(struct tomoyo_request_info *r, int len, const char *fmt,
/* +18 is for " symlink.target=\"%s\"" */
len += 18 + strlen(symlink);
}
- len = tomoyo_round2(len);
+ len = kmalloc_size_roundup(len);
buf = kzalloc(len, GFP_NOFS);
if (!buf)
goto out;
@@ -382,12 +382,12 @@ void tomoyo_write_log2(struct tomoyo_request_info *r, int len, const char *fmt,
goto out;
}
entry->log = buf;
- len = tomoyo_round2(strlen(buf) + 1);
+ len = kmalloc_size_roundup(strlen(buf) + 1);
/*
* The entry->size is used for memory quota checks.
* Don't go beyond strlen(entry->log).
*/
- entry->size = len + tomoyo_round2(sizeof(*entry));
+ entry->size = len + kmalloc_size_roundup(sizeof(*entry));
spin_lock(&tomoyo_log_lock);
if (tomoyo_memory_quota[TOMOYO_MEMORY_AUDIT] &&
tomoyo_memory_used[TOMOYO_MEMORY_AUDIT] + entry->size >=