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

login
register
mail settings
Submitter John Johansen
Date March 30, 2010, 5:39 p.m.
Message ID <1269970750-25624-3-git-send-email-john.johansen@canonical.com>
Download mbox | patch
Permalink /patch/48999/
State Accepted
Delegated to: Andy Whitcroft
Headers show

Comments

John Johansen - March 30, 2010, 5:39 p.m.
From: John Johansen <john.johansen@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@canonical.com>
---
 security/apparmor/apparmorfs.c |    2 +-
 security/apparmor/match.c      |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Patch

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) {