ima: use path names cache

__getname() uses slab allocation which is faster than kmalloc.
Make use of it.

Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com>
Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
This commit is contained in:
Dmitry Kasatkin
2014-10-01 21:43:10 +03:00
committed by Mimi Zohar
parent c2baec7ffa
commit 456f5fd3f6
2 changed files with 4 additions and 3 deletions

View File

@@ -325,11 +325,11 @@ const char *ima_d_path(struct path *path, char **pathbuf)
{
char *pathname = NULL;
*pathbuf = kmalloc(PATH_MAX, GFP_KERNEL);
*pathbuf = __getname();
if (*pathbuf) {
pathname = d_absolute_path(path, *pathbuf, PATH_MAX);
if (IS_ERR(pathname)) {
kfree(*pathbuf);
__putname(*pathbuf);
*pathbuf = NULL;
pathname = NULL;
}