[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180621211754.12757-3-h.peter.anvin@intel.com>
Date: Thu, 21 Jun 2018 14:17:49 -0700
From: "H. Peter Anvin, Intel" <h.peter.anvin@...el.com>
To: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Cc: "H. Peter Anvin" <hpa@...ux.intel.com>,
"H . Peter Anvin" <hpa@...or.com>, Ingo Molnar <mingo@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Andy Lutomirski <luto@...nel.org>,
"Chang S . Bae" <chang.seok.bae@...el.com>,
"Markus T . Metzger" <markus.t.metzger@...el.com>
Subject: [PATCH v3 2/7] x86/ldt: use a common value for read_default_ldt()
From: "H. Peter Anvin" <hpa@...ux.intel.com>
There is no point in having two different sizes for the "default ldt";
a concept which is obsolete anyway. Since this is kernel-dependent
and not user-space dependent, a 32-bit app needs to be able to accept
the 64-bit value anyway, so use that value, which is the larger of the
two.
Signed-off-by: H. Peter Anvin (Intel) <hpa@...or.com>
Cc: Ingo Molnar <mingo@...nel.org>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: Andy Lutomirski <luto@...nel.org>
Cc: Chang S. Bae <chang.seok.bae@...el.com>
Cc: Markus T. Metzger <markus.t.metzger@...el.com>
---
arch/x86/kernel/ldt.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/arch/x86/kernel/ldt.c b/arch/x86/kernel/ldt.c
index 18e9f4c0633d..601d24268a99 100644
--- a/arch/x86/kernel/ldt.c
+++ b/arch/x86/kernel/ldt.c
@@ -383,12 +383,8 @@ static int read_ldt(void __user *ptr, unsigned long bytecount)
static int read_default_ldt(void __user *ptr, unsigned long bytecount)
{
- /* CHECKME: Can we use _one_ random number ? */
-#ifdef CONFIG_X86_32
- unsigned long size = 5 * sizeof(struct desc_struct);
-#else
- unsigned long size = 128;
-#endif
+ const unsigned long size = 128;
+
if (bytecount > size)
bytecount = size;
if (clear_user(ptr, bytecount))
--
2.14.4
Powered by blists - more mailing lists