[PATCH] sysctl: flip file position warning to pr_warn_once

From: Kees Cook
Date: Wed May 07 2014 - 14:07:48 EST


To avoid dmesg flooding, use pr_warn_once instead of pr_warn.

Suggested-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Signed-off-by: Kees Cook <keescook@xxxxxxxxxxxx>
---
(follow-up to "sysctl-allow-for-strict-write-position-handling" series)
---
kernel/sysctl.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index e23d7017b870..3afb82cd08e4 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -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");
}

/**
--
1.7.9.5


--
Kees Cook
Chrome OS Security
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/