kaiser: fix build and FIXME in alloc_ldt_struct()
authorHugh Dickins <hughd@google.com>
Mon, 4 Sep 2017 00:09:44 +0000 (17:09 -0700)
committerYves-Alexis Perez <corsac@debian.org>
Thu, 4 Jan 2018 11:12:40 +0000 (11:12 +0000)
Include linux/kaiser.h instead of asm/kaiser.h to build ldt.c without
CONFIG_KAISER.  kaiser_add_mapping() does already return an error code,
so fix the FIXME.

Signed-off-by: Hugh Dickins <hughd@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Gbp-Pq: Topic features/all/kpti
Gbp-Pq: Name kaiser-fix-build-and-fixme-in-alloc_ldt_struct.patch

arch/x86/kernel/ldt.c

index 3c2d55bc6cbd9bfee6432b6d32b99bdb8ce6ca2f..8331bad03938f5e8e16e8894f0af89b310bd7440 100644 (file)
@@ -15,9 +15,9 @@
 #include <linux/slab.h>
 #include <linux/vmalloc.h>
 #include <linux/uaccess.h>
+#include <linux/kaiser.h>
 
 #include <asm/ldt.h>
-#include <asm/kaiser.h>
 #include <asm/desc.h>
 #include <asm/mmu_context.h>
 #include <asm/syscalls.h>
@@ -48,7 +48,7 @@ static struct ldt_struct *alloc_ldt_struct(int size)
 {
        struct ldt_struct *new_ldt;
        int alloc_size;
-       int ret = 0;
+       int ret;
 
        if (size > LDT_ENTRIES)
                return NULL;
@@ -76,10 +76,8 @@ static struct ldt_struct *alloc_ldt_struct(int size)
                return NULL;
        }
 
-       // FIXME: make kaiser_add_mapping() return an error code
-       // when it fails
-       kaiser_add_mapping((unsigned long)new_ldt->entries, alloc_size,
-                          __PAGE_KERNEL);
+       ret = kaiser_add_mapping((unsigned long)new_ldt->entries, alloc_size,
+                                __PAGE_KERNEL);
        if (ret) {
                __free_ldt_struct(new_ldt);
                return NULL;