[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20100816105502.GC645@bicker>
Date: Mon, 16 Aug 2010 12:55:02 +0200
From: Dan Carpenter <error27@...il.com>
To: Thomas Gleixner <tglx@...utronix.de>
Cc: Ingo Molnar <mingo@...hat.com>, "H. Peter Anvin" <hpa@...or.com>,
x86@...nel.org, Cliff Wickman <cpw@....com>,
Jack Steiner <steiner@....com>, Robin Holt <holt@....com>,
linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: [patch] tlb_uv: handle large snprintf() returns
snprintf() returns the number of bytes that *would* have been copied if
the buffer was large enough, so it can be larger than the size of the
buffer. In this case it's ok, but let's put a cap on it anyway so it's
easier to audit.
Signed-off-by: Dan Carpenter <error27@...il.com>
diff --git a/arch/x86/kernel/tlb_uv.c b/arch/x86/kernel/tlb_uv.c
index 312ef02..5e88b3a 100644
--- a/arch/x86/kernel/tlb_uv.c
+++ b/arch/x86/kernel/tlb_uv.c
@@ -1012,6 +1012,9 @@ static ssize_t tunables_read(struct file *file, char __user *userbuf,
timeoutsb4reset, ipi_reset_limit, complete_threshold,
congested_response_us, congested_reps, congested_period);
+ if (ret > 300)
+ ret = 300;
+
return simple_read_from_buffer(userbuf, count, ppos, buf, ret);
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists