diff options
| author | Ard Biesheuvel <ardb@kernel.org> | 2026-09-07 15:18:39 +0200 |
|---|---|---|
| committer | Ard Biesheuvel <ardb@kernel.org> | 2026-09-17 10:36:19 +0100 |
| commit | 3dc73845074fa32035e3e47fecf4c02b826296f0 (patch) | |
| tree | a31bfaa467045b4b2d0eb8986d7ee4e970cc18dc /tools/perf/scripts/python | |
| parent | d62858c982bcdfb971afe7d4834dd3186604a0ec (diff) | |
| download | linux-next-3dc73845074fa32035e3e47fecf4c02b826296f0.tar.gz linux-next-3dc73845074fa32035e3e47fecf4c02b826296f0.zip | |
efi/libstub: Use ucs2_string library for UTF-16 to UTF-8 conversion
Don't rely on sprintf() with a wide string conversion modifier to
convert the command line from UTF-16 to UTF-8. Instead, use the
existing ucs2 string library routine that does the same. Note that while
UEFI claims support for UTF-16, in practice it ignores surrogate pairs
entirely, and so the simplified UCS-2 character set (where each
character takes up exactly 2 bytes) is sufficient here.
This removes the only user of sprintf() in the EFI stub, so drop that
function as well.
Since boot memory is plentiful on UEFI systems, just establish a worst
case upper bound for the size of the buffer (which can never exceed
COMMAND_LINE_SIZE), and allocate that first. Then, perform the
conversion, and only fall back to processing the command line character
by character if that resulted in truncation. This makes the common
execution path much simpler.
Note that this no longer truncates the command line at the first
newline, but there is no evidence that this has ever been needed.
Reviewed-by: Vincent Mailhol <mailhol@kernel.org>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Diffstat (limited to 'tools/perf/scripts/python')
0 files changed, 0 insertions, 0 deletions
