Browse Source

charset: make u16_strnlen accessible at runtime

commit 1fabfeef506c ("efi_loader: parameter check in GetNextVariableName()")
introduces a check using u16_strnlen(). This code is used on EFI
runtime variables as well, so unless we mark it as runtime, the kernel
will crash trying to access it.

Fixes: 1fabfeef506c ("efi_loader: parameter check in GetNextVariableName()")
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Ilias Apalodimas 3 years ago
parent
commit
6974a4a373
1 changed files with 2 additions and 1 deletions
  1. 2 1
      lib/charset.c

+ 2 - 1
lib/charset.c

@@ -8,6 +8,7 @@
 #include <common.h>
 #include <charset.h>
 #include <capitalization.h>
+#include <efi_loader.h>
 #include <malloc.h>
 
 static struct capitalization_table capitalization_table[] =
@@ -372,7 +373,7 @@ size_t u16_strlen(const void *in)
 	return ret;
 }
 
-size_t u16_strnlen(const u16 *in, size_t count)
+size_t __efi_runtime u16_strnlen(const u16 *in, size_t count)
 {
 	size_t i;
 	for (i = 0; count-- && in[i]; i++);