From: "H. Peter Anvin" <h...@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) <h...@zytor.com> Cc: Ingo Molnar <mi...@kernel.org> Cc: Thomas Gleixner <t...@linutronix.de> Cc: Andy Lutomirski <l...@kernel.org> Cc: Chang S. Bae <chang.seok....@intel.com> Cc: Markus T. Metzger <markus.t.metz...@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