efi/libstub: Use snprintf with %ls to convert the command line
authorArvind Sankar <nivedita@alum.mit.edu>
Mon, 18 May 2020 19:07:16 +0000 (15:07 -0400)
committerArd Biesheuvel <ardb@kernel.org>
Wed, 20 May 2020 17:09:20 +0000 (19:09 +0200)
commit04b24409b42a9fcae2379a6ddcf9c827b9af7a45
treedabfaad46777b92ff88edf4dfffcc840f4414a64
parent15c316bcbc23b777eae4e21f129526190aa20af1
efi/libstub: Use snprintf with %ls to convert the command line

Now we can use snprintf to do the UTF-16 to UTF-8 translation for the
command line.

Drop the special "zero" trick to handle an empty command line. This was
unnecessary even before this since with options_chars == 0,
efi_utf16_to_utf8 would not have accessed options at all. snprintf won't
access it either with a precision of 0.

Signed-off-by: Arvind Sankar <nivedita@alum.mit.edu>
Link: https://lore.kernel.org/r/20200518190716.751506-25-nivedita@alum.mit.edu
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
drivers/firmware/efi/libstub/efi-stub-helper.c