[patch 10/18] x86, ds: fix bounds check in ds selftest

markus.t.metzger
2009-04-02T15:00:28Z

[-- Attachment #1: tip.master.ds_selftest.bounds_check.patch --]
[-- Type: text/plain, Size: 877 bytes --]

Fix a bad bounds check in the debug store selftest.

Signed-off-by: Markus Metzger <markus.t.metzger@intel.com>
---
arch/x86/kernel/ds_selftest.c | 7 6 + 1 - 0 !
1 file changed, 6 insertions(+), 1 deletion(-)

Index: b/arch/x86/kernel/ds_selftest.c
===================================================================
--- a/arch/x86/kernel/ds_selftest.c
+++ b/arch/x86/kernel/ds_selftest.c
@@ -47,8 +47,13 @@ static int ds_selftest_bts_consistency(c
printk(KERN_CONT "bad bts buffer setup...");
error = -1;
}
+ /*
+ * We allow top in [begin; end], since its not clear when the
+ * overflow adjustment happens: after the increment or before the
+ * write.
+ */
if ((trace->ds.top < trace->ds.begin) ||
- (trace->ds.end <= trace->ds.top)) {
+ (trace->ds.end < trace->ds.top)) {
printk(KERN_CONT "bts top out of bounds...");
error = -1;
}