[PATCH 2/4] AppArmor: Stop page allocation warnings that can occur on policy load

john.johansen at canonical.com john.johansen at canonical.com
Tue Mar 30 18:39:08 BST 2010


From: John Johansen <john.johansen at canonical.com>

Buglink: http://launchpad.net/bugs/458299

Policy load can allocate larger than page chunks of memory, but it will
attempt to use kmalloc first, and then only fall back to vmalloc if
it needs to.  Currently the NO_WARN flag is missing from kmalloc so
it dumps a warning message, when it fails.  As this isn't a real
failure lets quiet the warnings.

Signed-off-by: John Johansen <john.johansen at canonical.com>
---
 security/apparmor/apparmorfs.c |    2 +-
 security/apparmor/match.c      |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c
index 89a26a0..a852d06 100644
--- a/security/apparmor/apparmorfs.c
+++ b/security/apparmor/apparmorfs.c
@@ -41,7 +41,7 @@ static void *kvmalloc(size_t size)
 	if (size == 0)
 		return NULL;
 
-	buffer = kmalloc(size, GFP_KERNEL);
+	buffer = kmalloc(size, GFP_KERNEL | __GFP_NOWARN);
 	if (!buffer)
 		buffer = vmalloc(size);
 	return buffer;
diff --git a/security/apparmor/match.c b/security/apparmor/match.c
index 677d1c2..5a55959 100644
--- a/security/apparmor/match.c
+++ b/security/apparmor/match.c
@@ -72,7 +72,7 @@ static struct table_header *unpack_table(char *blob, size_t bsize)
 		goto out;
 
 	/* freed by free_table */
-	table = kmalloc(tsize, GFP_KERNEL);
+	table = kmalloc(tsize, GFP_KERNEL | __GFP_NOWARN);
 	if (!table)
 		table = vmalloc(tsize);
 	if (table) {
-- 
1.6.3.3




More information about the kernel-team mailing list