summaryrefslogtreecommitdiffstats
path: root/drivers/firmware/efi/libstub/file.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2020-07-08 18:49:15 +0200
committerArnaldo Carvalho de Melo <acme@redhat.com>2020-07-08 18:49:15 +0200
commitfacbf0b9820f34f14b54f567862b4a96e910f468 (patch)
treeee65e875e4167dd903f2745cfbf6b2735fd1cd9e /drivers/firmware/efi/libstub/file.c
parentperf symbols: Add s390 idle functions 'psw_idle' and 'psw_idle_exit' to list ... (diff)
parentMerge tag 'perf-tools-fixes-2020-07-07' of git://git.kernel.org/pub/scm/linux... (diff)
downloadlinux-facbf0b9820f34f14b54f567862b4a96e910f468.tar.xz
linux-facbf0b9820f34f14b54f567862b4a96e910f468.zip
Merge remote-tracking branch 'torvalds/master' into perf/core
To pick up fixes and move perf/core forward, minor conflict as perf_evlist__add_dummy() lost its 'perf_' prefix as it operates on a 'struct evlist', not on a 'struct perf_evlist', i.e. its tools/perf/ specific, it is not in libperf. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'drivers/firmware/efi/libstub/file.c')
-rw-r--r--drivers/firmware/efi/libstub/file.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/drivers/firmware/efi/libstub/file.c b/drivers/firmware/efi/libstub/file.c
index 2005e33b33d5..630caa6b1f4c 100644
--- a/drivers/firmware/efi/libstub/file.c
+++ b/drivers/firmware/efi/libstub/file.c
@@ -102,12 +102,20 @@ static int find_file_option(const efi_char16_t *cmdline, int cmdline_len,
if (!found)
return 0;
+ /* Skip any leading slashes */
+ while (cmdline[i] == L'/' || cmdline[i] == L'\\')
+ i++;
+
while (--result_len > 0 && i < cmdline_len) {
- if (cmdline[i] == L'\0' ||
- cmdline[i] == L'\n' ||
- cmdline[i] == L' ')
+ efi_char16_t c = cmdline[i++];
+
+ if (c == L'\0' || c == L'\n' || c == L' ')
break;
- *result++ = cmdline[i++];
+ else if (c == L'/')
+ /* Replace UNIX dir separators with EFI standard ones */
+ *result++ = L'\\';
+ else
+ *result++ = c;
}
*result = L'\0';
return i;