Messages in this thread Patch in this message | | | From | "H. Peter Anvin, Intel" <> | Subject | [PATCH v3 2/7] x86/ldt: use a common value for read_default_ldt() | Date | Thu, 21 Jun 2018 14:17:49 -0700 |
| |
From: "H. Peter Anvin" <hpa@linux.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@zytor.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Andy Lutomirski <luto@kernel.org> Cc: Chang S. Bae <chang.seok.bae@intel.com> Cc: Markus T. Metzger <markus.t.metzger@intel.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
| |