efi/libstub: Tidy up types and names of global cmdline variables
authorArd Biesheuvel <ardb@kernel.org>
Tue, 24 Dec 2019 15:10:24 +0000 (16:10 +0100)
committerIngo Molnar <mingo@kernel.org>
Wed, 25 Dec 2019 09:49:25 +0000 (10:49 +0100)
Drop leading underscores and use bool not int for true/false
variables set on the command line.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Cc: Arvind Sankar <nivedita@alum.mit.edu>
Cc: Borislav Petkov <bp@alien8.de>
Cc: James Morse <james.morse@arm.com>
Cc: Matt Fleming <matt@codeblueprint.co.uk>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-efi@vger.kernel.org
Link: https://lkml.kernel.org/r/20191224151025.32482-25-ardb@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
drivers/firmware/efi/libstub/arm-stub.c
drivers/firmware/efi/libstub/efi-stub-helper.c
drivers/firmware/efi/libstub/efistub.h

index 62280df09dd4742fce83bbc434c1c475ebb32174..7bbef4a6735048977b616a9f018d8d04fdcf5951 100644 (file)
@@ -37,7 +37,7 @@
 
 static u64 virtmap_base = EFI_RT_VIRTUAL_BASE;
 
-static efi_system_table_t *__section(.data) sys_table;
+static efi_system_table_t *__efistub_global sys_table;
 
 __pure efi_system_table_t *efi_system_table(void)
 {
index ef0ffa512c209f3237ff27684eb506d6c501cef3..f1b9c36934e9a4fe601b3edf81bbf44774b116e3 100644 (file)
  */
 #define EFI_READ_CHUNK_SIZE    (1024 * 1024)
 
-static unsigned long __chunk_size = EFI_READ_CHUNK_SIZE;
+static unsigned long efi_chunk_size = EFI_READ_CHUNK_SIZE;
 
-static int __section(.data) __nokaslr;
-static int __section(.data) __quiet;
-static int __section(.data) __novamap;
-static bool __section(.data) efi_nosoftreserve;
+static bool __efistub_global efi_nokaslr;
+static bool __efistub_global efi_quiet;
+static bool __efistub_global efi_novamap;
+static bool __efistub_global efi_nosoftreserve;
 
-int __pure nokaslr(void)
+bool __pure nokaslr(void)
 {
-       return __nokaslr;
+       return efi_nokaslr;
 }
-int __pure is_quiet(void)
+bool __pure is_quiet(void)
 {
-       return __quiet;
+       return efi_quiet;
 }
-int __pure novamap(void)
+bool __pure novamap(void)
 {
-       return __novamap;
+       return efi_novamap;
 }
 bool __pure __efi_soft_reserve_enabled(void)
 {
@@ -455,11 +455,11 @@ efi_status_t efi_parse_options(char const *cmdline)
 
        str = strstr(cmdline, "nokaslr");
        if (str == cmdline || (str && str > cmdline && *(str - 1) == ' '))
-               __nokaslr = 1;
+               efi_nokaslr = true;
 
        str = strstr(cmdline, "quiet");
        if (str == cmdline || (str && str > cmdline && *(str - 1) == ' '))
-               __quiet = 1;
+               efi_quiet = true;
 
        /*
         * If no EFI parameters were specified on the cmdline we've got
@@ -479,18 +479,18 @@ efi_status_t efi_parse_options(char const *cmdline)
        while (*str && *str != ' ') {
                if (!strncmp(str, "nochunk", 7)) {
                        str += strlen("nochunk");
-                       __chunk_size = -1UL;
+                       efi_chunk_size = -1UL;
                }
 
                if (!strncmp(str, "novamap", 7)) {
                        str += strlen("novamap");
-                       __novamap = 1;
+                       efi_novamap = true;
                }
 
                if (IS_ENABLED(CONFIG_EFI_SOFT_RESERVE) &&
                    !strncmp(str, "nosoftreserve", 7)) {
                        str += strlen("nosoftreserve");
-                       efi_nosoftreserve = 1;
+                       efi_nosoftreserve = true;
                }
 
                /* Group words together, delimited by "," */
@@ -644,8 +644,8 @@ efi_status_t handle_cmdline_files(efi_loaded_image_t *image,
                        while (size) {
                                unsigned long chunksize;
 
-                               if (IS_ENABLED(CONFIG_X86) && size > __chunk_size)
-                                       chunksize = __chunk_size;
+                               if (IS_ENABLED(CONFIG_X86) && size > efi_chunk_size)
+                                       chunksize = efi_chunk_size;
                                else
                                        chunksize = size;
 
index 4e2b33fd6a43123880d42b1e2332f4b063d1d911..c244b165005e818dc1df8f6b42479c25b052d4d1 100644 (file)
 #define EFI_ALLOC_ALIGN                EFI_PAGE_SIZE
 #endif
 
-extern int __pure nokaslr(void);
-extern int __pure is_quiet(void);
-extern int __pure novamap(void);
+#ifdef CONFIG_ARM
+#define __efistub_global       __section(.data)
+#else
+#define __efistub_global
+#endif
+
+extern bool __pure nokaslr(void);
+extern bool __pure is_quiet(void);
+extern bool __pure novamap(void);
 
 extern __pure efi_system_table_t  *efi_system_table(void);