Skip to contentSkip to conversation

sysctl: flip file position warning to pr_warn_once

PATCH New Kees Cook 1 participant 1 message May 7, 2014 Proc sysctl

lore
Share & tools
lore

Kees Cook

author
#0 lore raw

PATCH 1/1 sysctl: flip file position warning to pr_warn_once

To avoid dmesg flooding, use pr_warn_once instead of pr_warn.

---
(follow-up to "sysctl-allow-for-strict-write-position-handling" series)

---
 kernel/sysctl.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
kernel/sysctl.c +3 -3
index e23d7017b870..3afb82cd08e4 100644
@@ -1783,10 +1783,10 @@ static int _proc_do_string(char *data, int maxlen, int write,
 
 static void warn_sysctl_write(struct ctl_table *table)
 {
-	pr_warn("%s wrote to %s when file position was not 0!\n",
+	pr_warn_once("%s wrote to %s when file position was not 0!\n"
+		"This will not be supported in the future. To silence this\n"
+		"warning, set kernel.sysctl_writes_strict = -1\n",
 		current->comm, table->procname);
-	pr_warn("This will not be supported in the future.\n");
-	pr_warn("To silence warning, set kernel.sysctl_writes_strict = -1\n");
 }
 
 /**
Signature · 6 lines
1.7.9.5


-- 
Kees Cook
Chrome OS Security