summaryrefslogtreecommitdiffstats
path: root/arch/xtensa/platforms
diff options
context:
space:
mode:
authorMax Filippov <jcmvbkbc@gmail.com>2018-09-06 11:19:20 -0700
committerMax Filippov <jcmvbkbc@gmail.com>2018-09-06 11:29:31 -0700
commitef439d49e0bfb26cd5f03c88b4cb7cc9073ed30c (patch)
tree0e6f6e1dd486014ab7aad0b1880e3dba2a39851d /arch/xtensa/platforms
parent57361846b52bc686112da6ca5368d11210796804 (diff)
downloadlinux-ef439d49e0bfb26cd5f03c88b4cb7cc9073ed30c.tar.bz2
xtensa: ISS: don't allocate memory in platform_setup
Memory allocator is not initialized at that point yet, use static array instead. Cc: stable@vger.kernel.org Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Diffstat (limited to 'arch/xtensa/platforms')
-rw-r--r--arch/xtensa/platforms/iss/setup.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/arch/xtensa/platforms/iss/setup.c b/arch/xtensa/platforms/iss/setup.c
index f4bbb28026f8..58709e89a8ed 100644
--- a/arch/xtensa/platforms/iss/setup.c
+++ b/arch/xtensa/platforms/iss/setup.c
@@ -78,23 +78,28 @@ static struct notifier_block iss_panic_block = {
void __init platform_setup(char **p_cmdline)
{
+ static void *argv[COMMAND_LINE_SIZE / sizeof(void *)] __initdata;
+ static char cmdline[COMMAND_LINE_SIZE] __initdata;
int argc = simc_argc();
int argv_size = simc_argv_size();
if (argc > 1) {
- void **argv = alloc_bootmem(argv_size);
- char *cmdline = alloc_bootmem(argv_size);
- int i;
+ if (argv_size > sizeof(argv)) {
+ pr_err("%s: command line too long: argv_size = %d\n",
+ __func__, argv_size);
+ } else {
+ int i;
- cmdline[0] = 0;
- simc_argv((void *)argv);
+ cmdline[0] = 0;
+ simc_argv((void *)argv);
- for (i = 1; i < argc; ++i) {
- if (i > 1)
- strcat(cmdline, " ");
- strcat(cmdline, argv[i]);
+ for (i = 1; i < argc; ++i) {
+ if (i > 1)
+ strcat(cmdline, " ");
+ strcat(cmdline, argv[i]);
+ }
+ *p_cmdline = cmdline;
}
- *p_cmdline = cmdline;
}
atomic_notifier_chain_register(&panic_notifier_list, &iss_panic_block);