From patchwork Thu Apr 13 22:35:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joshua Clayton X-Patchwork-Id: 9680409 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8B725601C3 for ; Thu, 13 Apr 2017 22:36:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7CE702861E for ; Thu, 13 Apr 2017 22:36:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6FADE28663; Thu, 13 Apr 2017 22:36:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 031EB2861E for ; Thu, 13 Apr 2017 22:36:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=enLrFzISvcXl8wQoe+FxzDHC//jidmbhVfkx54QYHHo=; b=LlW G1pG/zzdmxmXOVpsyFjf9DwCMnIcGy3/dQHbwIGVq5uUVO0+wWE2IbJrChhExfg711SEi4GZR+V22 58tovWI8Wg9yv21SU+RdJ1LGUYw7BsznEpIi001KHNfbRnP3MYRA6hHs86uDq174z0EfB6/gCdAhH gG88xSfIljBgWcd9UW2rn3jD3d91G/fqSyS2cVo6mhFxaZflvEa5uvmmNpmxs9Z2cWVz5I3V5hNAq G5Kdc8OKV3DFLKDuKZJHppp9zf24lY4Y47iwDZMHxna/EAGSU3aIZk0PwB5Ejyw6sKxD6g2rjZU4P OonO0PwW/iPRaJJF4dyWb2SX8o3BaEw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cynLn-0000cx-V3; Thu, 13 Apr 2017 22:36:27 +0000 Received: from mail-pf0-x243.google.com ([2607:f8b0:400e:c00::243]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cynLk-0000ad-PZ for linux-arm-kernel@lists.infradead.org; Thu, 13 Apr 2017 22:36:26 +0000 Received: by mail-pf0-x243.google.com with SMTP id a188so13021391pfa.2 for ; Thu, 13 Apr 2017 15:36:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=HbfkP1M1ACcJfv8ciKcdpNOsN6H9x3Yq64dYIyWzNZc=; b=Jh1ywJJ/xAklzwDkCOiT53na84GUV573LsvoOiIrPKWUZ1/2wwLqvW2mKAnPWs/a2l 7oHcqJS3jyMfpwsqMjU8EOlDc4aO7SGCU8dPiuKbL5kUDtT2K3mlefgw+q7Pe38osmdF +cA26wSEPOHFXuH3SZNtZynh4eO3pGBtA5JHywdOzUxyHPPxVWHMBp3y/xwE0vJbbNo3 CKR1KhZALON+CUAA1oxDjjG3KdAA+e+ML3HeDd2YaAmv4Q0w4VNl+ITDYuo5VC+2Xg1R YTfnbYFyxHvqVG0dFpKeJQgEOBoMjuG3PRzfVcSbf4oI1HSwe/qUSfatxUow4jS0JO7u uW0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=HbfkP1M1ACcJfv8ciKcdpNOsN6H9x3Yq64dYIyWzNZc=; b=BxlxLTbPSXIJsE7qISXZINKlPQ9FAw/qdT4Ek6+E7Ry8RkdFdKtmERjvUxey5mZ+6K ALH/J1zfJNrAnv39q/Eq1/WCXJqnXNahE6hMNRA4Al6eOKE1OBgmDb9JAb7Pmie4fbru ZlE3nQQv27YCjXhtjz7zb8gry8T4Svh4YlXA4195z/wDnMF9VM+yN4M7XzKrZOgo1dFh JHcdaRS+pET4lEyqfNGWlanAMI4V+9qsJ9dKTL+6hwxUrUD/2Xxix+tu859tdDUEOxBB UrUBTSEfiDqMsTWapRfaUPvGRWGZL6SaSKPTxycIJL4E1DkKM44sd0BYU4MZAfDZLlR1 syPw== X-Gm-Message-State: AN3rC/58b6Z3gusZpz1FCgaiyVACqCOs83jVgn5vehhmfXO+rymuNYTb rnVv1LLuTptYkw== X-Received: by 10.84.129.67 with SMTP id 61mr5627008plb.16.1492122961573; Thu, 13 Apr 2017 15:36:01 -0700 (PDT) Received: from jclayton-pc.columbia.uniwest.com (68-185-59-186.static.knwc.wa.charter.com. [68.185.59.186]) by smtp.gmail.com with ESMTPSA id w23sm68117pfa.84.2017.04.13.15.35.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Apr 2017 15:36:00 -0700 (PDT) From: Joshua Clayton To: Russell King Subject: [PATCH] ARM: zImage: fix warning in merge_fdt_bootargs() Date: Thu, 13 Apr 2017 15:35:49 -0700 Message-Id: <20170413223549.18082-1-stillcompiling@gmail.com> X-Mailer: git-send-email 2.9.3 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170413_153624_856933_D68A83F5 X-CRM114-Status: GOOD ( 16.79 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Joshua Clayton , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP gcc produces the following warning: arch/arm/boot/compressed/atags_to_fdt.c: In function 'merge_fdt_bootargs': arch/arm/boot/compressed/atags_to_fdt.c:98:1: warning: the frame size of 1032 bytes is larger than 1024 bytes [-Wframe-larger-than=] Update merge_fdt_bootargs() so that instead of a 1k buffer on the stack, it calls fdt_appendprop_string() Signed-off-by: Joshua Clayton --- I tried testing this on my imx6 setup by adding bogus text to the command line, but it appears that with my (recent) uboot the codepath is not executed. So this could be regarded as little more than compile-tested. arch/arm/boot/compressed/atags_to_fdt.c | 32 ++++++++------------------------ 1 file changed, 8 insertions(+), 24 deletions(-) diff --git a/arch/arm/boot/compressed/atags_to_fdt.c b/arch/arm/boot/compressed/atags_to_fdt.c index 9448aa0..fefb30a 100644 --- a/arch/arm/boot/compressed/atags_to_fdt.c +++ b/arch/arm/boot/compressed/atags_to_fdt.c @@ -66,35 +66,19 @@ static uint32_t get_cell_size(const void *fdt) return cell_size; } -static void merge_fdt_bootargs(void *fdt, const char *fdt_cmdline) +static void merge_fdt_bootargs(void *fdt, const char *cmdline) { - char cmdline[COMMAND_LINE_SIZE]; const char *fdt_bootargs; - char *ptr = cmdline; + int offset = node_offset(fdt, "/chosen"); int len = 0; - /* copy the fdt command line into the buffer */ - fdt_bootargs = getprop(fdt, "/chosen", "bootargs", &len); - if (fdt_bootargs) - if (len < COMMAND_LINE_SIZE) { - memcpy(ptr, fdt_bootargs, len); - /* len is the length of the string - * including the NULL terminator */ - ptr += len - 1; - } - - /* and append the ATAG_CMDLINE */ - if (fdt_cmdline) { - len = strlen(fdt_cmdline); - if (ptr - cmdline + len + 2 < COMMAND_LINE_SIZE) { - *ptr++ = ' '; - memcpy(ptr, fdt_cmdline, len); - ptr += len; - } + /* get the ftd command line length */ + fdt_bootargs = fdt_getprop(fdt, offset, "bootargs", &len); + /* append the ATAG_CMDLINE if its not too big */ + if (cmdline && ((len + strlen(cmdline)) < (COMMAND_LINE_SIZE - 2))) { + fdt_appendprop_string(fdt, offset, "bootargs", " "); + fdt_appendprop_string(fdt, offset, "bootargs", cmdline); } - *ptr = '\0'; - - setprop_string(fdt, "/chosen", "bootargs", cmdline); } /*