summaryrefslogtreecommitdiff
path: root/tools/perf/python
diff options
context:
space:
mode:
authorArd Biesheuvel <ardb@kernel.org>2026-09-07 15:18:39 +0200
committerArd Biesheuvel <ardb@kernel.org>2026-10-04 21:53:56 +0200
commit899ff1dbc8842b4b6d1b8ade94a86a2336bbc86c (patch)
treea6e3fe6b38b247901ddccca7018f55b7fc36c10a /tools/perf/python
parent0f5a86b29fcc1c1f4e4be5d5899de52217ecd5be (diff)
downloadlinux-next-899ff1dbc8842b4b6d1b8ade94a86a2336bbc86c.tar.gz
linux-next-899ff1dbc8842b4b6d1b8ade94a86a2336bbc86c.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/python')
0 files changed, 0 insertions, 0 deletions