From: "H. Peter Anvin" <[email protected]> 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) <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Andy Lutomirski <[email protected]> Cc: Chang S. Bae <[email protected]> Cc: Markus T. Metzger <[email protected]> --- 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

