Signed-off-by: Andrew Jones <drjones@xxxxxxxxxx> Reviewed-by: Thomas Huth <thuth@xxxxxxxxxx> --- lib/argv.c | 4 ---- powerpc/emulator.c | 2 +- powerpc/rtas.c | 12 ++++++------ powerpc/selftest.c | 8 ++++---- powerpc/spapr_hcall.c | 6 +++--- 5 files changed, 14 insertions(+), 18 deletions(-) diff --git a/lib/argv.c b/lib/argv.c index 1c6c6a44c836d..c6ad5fcbc8cf4 100644 --- a/lib/argv.c +++ b/lib/argv.c @@ -38,13 +38,9 @@ void setup_args(char *args) __args = args; __setup_args(); -#if defined(__arm__) || defined(__aarch64__) for (int i = __argc; i > 0; --i) __argv[i] = __argv[i-1]; -#endif } -#if defined(__arm__) || defined(__aarch64__) __argv[0] = NULL; //HACK: just reserve argv[0] for now ++__argc; -#endif } diff --git a/powerpc/emulator.c b/powerpc/emulator.c index 0e5f7a35cdb7f..04c448014ae9c 100644 --- a/powerpc/emulator.c +++ b/powerpc/emulator.c @@ -354,7 +354,7 @@ int main(int argc, char **argv) handle_exception(0x700, program_check_handler, (void *)&is_invalid); handle_exception(0x600, alignment_handler, (void *)&alignment); - for (i = 0; i < argc; i++) { + for (i = 1; i < argc; i++) { if (strcmp(argv[i], "-v") == 0) { verbose = 1; } diff --git a/powerpc/rtas.c b/powerpc/rtas.c index 9d673f0ce8d93..1b1e9c753ef1b 100644 --- a/powerpc/rtas.c +++ b/powerpc/rtas.c @@ -115,23 +115,23 @@ int main(int argc, char **argv) report_prefix_push("rtas"); - if (!argc) + if (argc < 2) report_abort("no test specified"); - report_prefix_push(argv[0]); + report_prefix_push(argv[1]); - if (strcmp(argv[0], "get-time-of-day") == 0) { + if (strcmp(argv[1], "get-time-of-day") == 0) { - len = parse_keyval(argv[1], &val); + len = parse_keyval(argv[2], &val); if (len == -1) { printf("Missing parameter \"date\"\n"); abort(); } - argv[1][len] = '\0'; + argv[2][len] = '\0'; check_get_time_of_day(val); - } else if (strcmp(argv[0], "set-time-of-day") == 0) { + } else if (strcmp(argv[1], "set-time-of-day") == 0) { check_set_time_of_day(); diff --git a/powerpc/selftest.c b/powerpc/selftest.c index 84867e482d2a2..8c5ff0ac889d4 100644 --- a/powerpc/selftest.c +++ b/powerpc/selftest.c @@ -49,14 +49,14 @@ int main(int argc, char **argv) { report_prefix_push("selftest"); - if (!argc) + if (argc < 2) report_abort("no test specified"); - report_prefix_push(argv[0]); + report_prefix_push(argv[1]); - if (strcmp(argv[0], "setup") == 0) { + if (strcmp(argv[1], "setup") == 0) { - check_setup(argc-1, &argv[1]); + check_setup(argc-2, &argv[2]); } diff --git a/powerpc/spapr_hcall.c b/powerpc/spapr_hcall.c index dbff63013297b..656aaff61405b 100644 --- a/powerpc/spapr_hcall.c +++ b/powerpc/spapr_hcall.c @@ -154,13 +154,13 @@ int main(int argc, char **argv) report_prefix_push("hypercall"); - if (!argc || (argc == 1 && !strcmp(argv[0], "all"))) + if (argc < 2 || (argc == 2 && !strcmp(argv[1], "all"))) all = 1; for (i = 0; hctests[i].name != NULL; i++) { report_prefix_push(hctests[i].name); - if (all || strcmp(argv[0], hctests[i].name) == 0) { - hctests[i].func(argc, argv); + if (all || strcmp(argv[1], hctests[i].name) == 0) { + hctests[i].func(argc-1, &argv[1]); } report_prefix_pop(); } -- 2.4.11 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html