[PATCH -mmotm] kptr_restrict: fix build when PRINTK not enabled

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Randy Dunlap
Date: Friday, December 24, 2010 - 10:52 am

From: Randy Dunlap <randy.dunlap@oracle.com>

#include <linux/printk.h> since that is where kptr_restrict is externed.

Put kptr_restrict inside #ifdef CONFIG_PRINTK block to fix build error
when CONFIG_PRINTK is not enabled:

kernel/sysctl.c:712: error: 'kptr_restrict' undeclared here (not in a function)

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Cc: Dan Rosenberg <drosenberg@vsecurity.com>
---
 kernel/sysctl.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- mmotm-2010-1223-1658.orig/kernel/sysctl.c
+++ mmotm-2010-1223-1658/kernel/sysctl.c
@@ -24,6 +24,7 @@
 #include <linux/slab.h>
 #include <linux/sysctl.h>
 #include <linux/signal.h>
+#include <linux/printk.h>
 #include <linux/proc_fs.h>
 #include <linux/security.h>
 #include <linux/ctype.h>
@@ -706,7 +707,6 @@ static struct ctl_table kern_table[] = {
 		.extra1		= &zero,
 		.extra2		= &one,
 	},
-#endif
 	{
 		.procname	= "kptr_restrict",
 		.data		= &kptr_restrict,
@@ -716,6 +716,7 @@ static struct ctl_table kern_table[] = {
 		.extra1		= &zero,
 		.extra2		= &two,
 	},
+#endif
 	{
 		.procname	= "ngroups_max",
 		.data		= &ngroups_max,



---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
desserts:  http://www.xenotime.net/linux/recipes/
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
mmotm 2010-12-23-16-58 uploaded, akpm, (Thu Dec 23, 5:58 pm)
Re: mmotm 2010-12-23-16-58 uploaded, Andrew Morton, (Fri Dec 24, 6:04 am)
[PATCH -mmotm] kptr_restrict: fix build when PRINTK not en ..., Randy Dunlap, (Fri Dec 24, 10:52 am)
Re: mmotm 2010-12-23-16-58 uploaded, Randy Dunlap, (Sun Dec 26, 7:13 pm)