Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2508764imm; Mon, 24 Sep 2018 05:39:51 -0700 (PDT) X-Google-Smtp-Source: ACcGV60dnnmKKtbxK+4SHkIvNQzddWKIaZ6hE3JE6y2hxSuobFZ+EpvceBT1i9zdi1z7FKYTPXZ1 X-Received: by 2002:a17:902:76c2:: with SMTP id j2-v6mr2633170plt.300.1537792791064; Mon, 24 Sep 2018 05:39:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537792791; cv=none; d=google.com; s=arc-20160816; b=Mc7ESpoclJTz9Y3I9GnUgRKTQ40HYwyvngbRuISz2zc1ydixJJfv074QZJ/J4HPaXc 91PCoce8Z+X1fe3n39Dd7IA5A10PhecHOnXl9+dwuZnPLypm6eBsBCWURK3SkIx7Omxc 882ZE2Hls8xp+5d07iDdcRGoNVnxyfrUcuWuWt+Ui8lejgA8TjUtwiK/Ifh7bSHkxfMm aj+KnfSP4TaA2B0Egq9Z70o93xV/qtXJaANc/0sy4EsjLESrMZRD4OxaOe83EGtuZVzM +/b2e9nTzzgfIM8CII3CFy2JekI2g0QA3FyHf6k4hRDvZ6hv20lOrBtEyQGBDLIaed/o 4zoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from; bh=DarlvynSV8qsqylWDa6+vzuplrsy1V5iPUb2Qx58Mok=; b=0cXnhbpBIa58NBxMCv7pMRUhCRZedACNNDB7l5cx2KlxVwAFnGg6dlIZc8XICpZdGx suvYM5/CIFMUJwBapU5/hetLQeU91zy7cLC5sLMF1YyH3ccSKLsGsUNa6mO3jn5bhbHD FAsstrzmOIVGiZwaLHUnIphm6ecr5CUdPWZVvQa8+KHdA6xxC1UwzHU1Eb8k6Doom1+C 5uqJ3GSujMy/9bU02zYaDO2NVU2mI4hR3sRKa/zh61gHdex9ioj/wDA9MXAWUWwrM9AF XEkVuGettL1e3LW9NQ0NFa+/slkOULKRDW3PLIor24GR51h+egUi8WZFfPAns+wqlo7S ewPA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i21-v6si11327600pgh.53.2018.09.24.05.39.36; Mon, 24 Sep 2018 05:39:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388331AbeIXSka (ORCPT + 99 others); Mon, 24 Sep 2018 14:40:30 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:58734 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728702AbeIXSk3 (ORCPT ); Mon, 24 Sep 2018 14:40:29 -0400 Received: from localhost (ip-213-127-77-73.ip.prioritytelecom.net [213.127.77.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 76242107F; Mon, 24 Sep 2018 12:38:32 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Max Filippov Subject: [PATCH 4.18 137/235] xtensa: ISS: dont allocate memory in platform_setup Date: Mon, 24 Sep 2018 13:52:03 +0200 Message-Id: <20180924113119.431850381@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180924113103.999624566@linuxfoundation.org> References: <20180924113103.999624566@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Max Filippov commit ef439d49e0bfb26cd5f03c88b4cb7cc9073ed30c upstream. Memory allocator is not initialized at that point yet, use static array instead. Cc: stable@vger.kernel.org Signed-off-by: Max Filippov Signed-off-by: Greg Kroah-Hartman --- arch/xtensa/platforms/iss/setup.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) --- a/arch/xtensa/platforms/iss/setup.c +++ b/arch/xtensa/platforms/iss/setup.c @@ -78,23 +78,28 @@ static struct notifier_block iss_panic_b 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);