From 22ca923f71dd2d59d7f314d186801acb50524106 Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Tue, 1 Jan 2019 21:50:49 +0100 Subject: [PATCH] kernel/x86_64: Fix descriptor index off-by-one in assert. This was apparently copied from GlobalDescriptorTable::SetTSS() which needs two table entries and therefore checks for index + 1. For the SetUserTLS case this isn't needed and would cause aborts when reaching the maximum CPU count (64 currently). Change-Id: I27bd777fedadbd3740ac8c791199ec9300b06327 Reviewed-on: https://review.haiku-os.org/809 Reviewed-by: waddlesplash --- src/system/kernel/arch/x86/64/descriptors.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/system/kernel/arch/x86/64/descriptors.cpp b/src/system/kernel/arch/x86/64/descriptors.cpp index fd5d6ce68f..758f2c0b6e 100644 --- a/src/system/kernel/arch/x86/64/descriptors.cpp +++ b/src/system/kernel/arch/x86/64/descriptors.cpp @@ -280,7 +280,7 @@ unsigned GlobalDescriptorTable::SetUserTLS(unsigned cpu, uintptr_t base, size_t limit) { auto index = kFirstTSS + cpu * 3 + 2; - ASSERT(index + 1 < kDescriptorCount); + ASSERT(index < kDescriptorCount); UserTLSDescriptor desc(base, limit); fTable[index] = desc.GetDescriptor(); return index;