Message ID | 20201122131027.1017975-1-ilias.apalodimas@linaro.org |
---|---|
State | Accepted |
Commit | 6974a4a37348ba272e53dd33effcc0db9e144c59 |
Headers | show |
Series | charset: make u16_strnlen accessible at runtime | expand |
On 11/22/20 2:10 PM, Ilias Apalodimas wrote: > 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> Thanks for the fix. Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de> > --- > lib/charset.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/lib/charset.c b/lib/charset.c > index 5686d6fb59ce..2177014ee1c5 100644 > --- a/lib/charset.c > +++ b/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++); >
diff --git a/lib/charset.c b/lib/charset.c index 5686d6fb59ce..2177014ee1c5 100644 --- a/lib/charset.c +++ b/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++);
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> --- lib/charset.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.29.2