From patchwork Wed Nov 21 05:10:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Li Qiang X-Patchwork-Id: 10691943 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B6C0414BD for ; Wed, 21 Nov 2018 05:14:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9A3B02B6DB for ; Wed, 21 Nov 2018 05:14:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8D7012B6EB; Wed, 21 Nov 2018 05:14:06 +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=-7.7 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2BACA2B6DB for ; Wed, 21 Nov 2018 05:14:06 +0000 (UTC) Received: from localhost ([::1]:37259 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gPKpx-0006st-Fz for patchwork-qemu-devel@patchwork.kernel.org; Wed, 21 Nov 2018 00:14:05 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43687) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gPKmd-0003x2-Gq for qemu-devel@nongnu.org; Wed, 21 Nov 2018 00:10:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gPKmc-0002s7-KR for qemu-devel@nongnu.org; Wed, 21 Nov 2018 00:10:39 -0500 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]:44625) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gPKmc-0002rL-Eq for qemu-devel@nongnu.org; Wed, 21 Nov 2018 00:10:38 -0500 Received: by mail-pl1-x643.google.com with SMTP id s5-v6so3680450plq.11 for ; Tue, 20 Nov 2018 21:10:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=puXFQ7OfKzb+VLLxifuz4MhCgujjxYyxi/iu7h5V8kU=; b=irOaeTzreXMHkCNcVFYRl2Uq0Ab5Wf91bQczjObJdw3MMydKPmIPB2y03P5MOJaavD p9o9Ya1PW0BF3lSIzayCdT2uiEr1CDRzwj1nKmu4N6IKHJPxBR//5lup4nAxCqSsZwSY Hswk8gi7Z+YnrPVxaVAqj6JK6n4z9nwNAa6W3cE2aV63Ns4m79PtuaLVFg0PfcrRQBIv 5kKjIDDt7KwqHrZ+QFUkz8QYHniPlRYPYXg303KZAVz6344E2zL/Gdph+YZcF8NJllVE 5MVG/VbT+qoUWpTatqt85AlCcVq9Fa8GcgXfwkx9CNjF8wPGvew0A9eBBTGJS7ZGsl2u SYMg== 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:in-reply-to :references; bh=puXFQ7OfKzb+VLLxifuz4MhCgujjxYyxi/iu7h5V8kU=; b=Gf7mzk+o5+LRj7eTgsIWNyhYkCrw845V764C4zUjmQfLtbHcbchvYng7v6C1+NWW4B l+zeciycSSOsLSpyboWK7xOqQ6pNA/RP7c8/glgGEARyKvJP+urTTPfhXR6CxuEkirfT D7yijXVh9J/pKZevl3sbpSZ4eQmhVr3mUfAFhTNjJqhbfywxWIp/btIDLGHFi8xHTOnV QeCc/cy/dTK9/+66JZoLtO28Yr0TYUOJOZLyaxiTuL0o3Y7d30ahHIaQNBu1qVUKnbYz sqPapLhaGhJcKLrPNzYO4IehAq0A7VnQBMD7PIxdfn2pxUD/5NlpSPv0MpIXeLHvTKLK 5DxA== X-Gm-Message-State: AA+aEWbLXHyi+vAg+adPY/ghIzEuYcEK7xKYGaw/CbdgKEeWz5emxj7h Z+D4gkh5p6CMAnFvd1q12Fc= X-Google-Smtp-Source: AFSGD/UKWHp9vHuewxWTE0yV95b9wJ3I+O/sjzACnGD9Hd8vHNU2bCPdQghlbL2ygRVr0EdxxUdwtA== X-Received: by 2002:a65:6215:: with SMTP id d21mr4602323pgv.289.1542777037551; Tue, 20 Nov 2018 21:10:37 -0800 (PST) Received: from localhost.localdomain.localdomain ([103.129.255.252]) by smtp.gmail.com with ESMTPSA id b62-v6sm52846616pfa.159.2018.11.20.21.10.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Nov 2018 21:10:37 -0800 (PST) From: Li Qiang To: armbru@redhat.com, pbonzini@redhat.com, kraxel@redhat.com, lersek@redhat.com, philmd@redhat.com Date: Tue, 20 Nov 2018 21:10:24 -0800 Message-Id: <1542777026-2788-2-git-send-email-liq3ea@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1542777026-2788-1-git-send-email-liq3ea@gmail.com> References: <1542777026-2788-1-git-send-email-liq3ea@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::643 Subject: [Qemu-devel] [PATCH v2 1/3] fw_cfg: fix -boot bootsplash error checking X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: liq3ea@gmail.com, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP fw_cfg_bootsplash() gets option parameter "splash-time" with qemu_opt_get(), then converts it to an integer by hand. It neglects to check that conversion for errors. This is needlessly complicated and error-prone. But as "splash-time not specified" is not the same as "splash-time=T" for any T, we need use qemu_opt_get() to check if splash time exists. This patch also make the qemu exit when finding or loading splash file failed. Signed-off-by: Li Qiang Reviewed-by: Markus Armbruster Reviewed-by: Philippe Mathieu-Daudé --- v1->v2: drop error_report when read_splashfile() fails hw/nvram/fw_cfg.c | 35 +++++++++++++---------------------- vl.c | 2 +- 2 files changed, 14 insertions(+), 23 deletions(-) diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c index 946f765f7f..83d66818f6 100644 --- a/hw/nvram/fw_cfg.c +++ b/hw/nvram/fw_cfg.c @@ -118,47 +118,38 @@ error: static void fw_cfg_bootsplash(FWCfgState *s) { - int boot_splash_time = -1; const char *boot_splash_filename = NULL; - char *p; + const char *boot_splash_time = NULL; char *filename, *file_data; gsize file_size; int file_type; - const char *temp; /* get user configuration */ QemuOptsList *plist = qemu_find_opts("boot-opts"); QemuOpts *opts = QTAILQ_FIRST(&plist->head); - if (opts != NULL) { - temp = qemu_opt_get(opts, "splash"); - if (temp != NULL) { - boot_splash_filename = temp; - } - temp = qemu_opt_get(opts, "splash-time"); - if (temp != NULL) { - p = (char *)temp; - boot_splash_time = strtol(p, &p, 10); - } - } + boot_splash_filename = qemu_opt_get(opts, "splash"); + boot_splash_time = qemu_opt_get(opts, "splash-time"); /* insert splash time if user configurated */ - if (boot_splash_time >= 0) { + if (boot_splash_time) { + int64_t bst_val = qemu_opt_get_number(opts, "splash-time", -1); /* validate the input */ - if (boot_splash_time > 0xffff) { - error_report("splash time is big than 65535, force it to 65535."); - boot_splash_time = 0xffff; + if (bst_val < 0 || bst_val > 0xffff) { + error_report("splash-time is invalid," + "it should be a value between 0 and 65535"); + exit(1); } /* use little endian format */ - qemu_extra_params_fw[0] = (uint8_t)(boot_splash_time & 0xff); - qemu_extra_params_fw[1] = (uint8_t)((boot_splash_time >> 8) & 0xff); + qemu_extra_params_fw[0] = (uint8_t)(bst_val & 0xff); + qemu_extra_params_fw[1] = (uint8_t)((bst_val >> 8) & 0xff); fw_cfg_add_file(s, "etc/boot-menu-wait", qemu_extra_params_fw, 2); } /* insert splash file if user configurated */ - if (boot_splash_filename != NULL) { + if (boot_splash_filename) { filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, boot_splash_filename); if (filename == NULL) { - error_report("failed to find file '%s'.", boot_splash_filename); + error_report("failed to find file '%s'", boot_splash_filename); return; } diff --git a/vl.c b/vl.c index fa25d1ae2d..96ac0ddcf6 100644 --- a/vl.c +++ b/vl.c @@ -336,7 +336,7 @@ static QemuOptsList qemu_boot_opts = { .type = QEMU_OPT_STRING, }, { .name = "splash-time", - .type = QEMU_OPT_STRING, + .type = QEMU_OPT_NUMBER, }, { .name = "reboot-timeout", .type = QEMU_OPT_STRING, From patchwork Wed Nov 21 05:10:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Li Qiang X-Patchwork-Id: 10691939 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EE36614BD for ; Wed, 21 Nov 2018 05:12:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D22392B6E3 for ; Wed, 21 Nov 2018 05:12:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C61CC2B6E6; Wed, 21 Nov 2018 05:12:00 +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=-7.7 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6CF862B6EB for ; Wed, 21 Nov 2018 05:12:00 +0000 (UTC) Received: from localhost ([::1]:37251 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gPKnv-0004ny-M1 for patchwork-qemu-devel@patchwork.kernel.org; Wed, 21 Nov 2018 00:11:59 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43714) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gPKmg-0003yG-6x for qemu-devel@nongnu.org; Wed, 21 Nov 2018 00:10:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gPKmf-0002wc-ER for qemu-devel@nongnu.org; Wed, 21 Nov 2018 00:10:42 -0500 Received: from mail-pl1-x644.google.com ([2607:f8b0:4864:20::644]:41375) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gPKmf-0002vf-8d for qemu-devel@nongnu.org; Wed, 21 Nov 2018 00:10:41 -0500 Received: by mail-pl1-x644.google.com with SMTP id u6so3686176plm.8 for ; Tue, 20 Nov 2018 21:10:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=0zb5N5AbqXddbzmg7qR+gXe/f6u/EHZ8/2vSauq5I6Q=; b=e90HWB0Ats89t9NGXdVrj1NTMP9iJ0oSbXFydpVruzRy+HEmaYNELvW7rApzYmL6P2 xCczP6Ed3YNUiW/MPZNTKCvv78qJ8psOcYBPSzC75+WsDB1odCtXZwH0wqTlKenxeiqK ATPzM5gHlTr1ZcfojH+1Ocer4QkBrk8NELmnWfCU68KATFWTTsJbap6GlB/eUav/U4Sm xeIFYqJ/Z818dThVjclYpl+iQfsdxB8aiSonq+EFAmCZ+4XZXkYqOHAvMhhml7kWxCCa 3Qe+WwoLNtkF/6zkRei6uT6C5YDovHmDmHWovtFrNcWTZeYXlbnYDbAVdB3RlmBIy8nE oEiw== 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:in-reply-to :references; bh=0zb5N5AbqXddbzmg7qR+gXe/f6u/EHZ8/2vSauq5I6Q=; b=HYSt8t8TlFveqA9jvk2EdEHoCiKf/AAZTVvdqwz+F2UVM6SJ7ybKFhdTFamOAoBxP9 WgHn4krHxd0rC3NmSFs0tZI+N625CtJ0HjVgoEfgYKqfZ4SmPY0vfnB6rVxXRztMYHzf xhIT0JgKUUwNKUkDy4/MtjFTOC3IjmCh2FhHexcg9FnLwd6C/P9ZOz0DXEvplPDTE/gN WN+ze8X1yqMpEFRewCCnsGa+68O176tYTDClYMIcTVSdywSKUb5PTIDAEWHPJYTHOEyo UPS6ZuhG9V5O3npI5sgh7rTDkXh4wshYyRUfmTduw3CC4GrKosdRELDq0hOFd1ZiSsJr cTsg== X-Gm-Message-State: AA+aEWaBypWrCwsWUZCweLey3tEXoDudrn0TDbZdqYjodYkdnMt/RmAe qlA7ovYF2kZ346g/+PUK9Vk= X-Google-Smtp-Source: AFSGD/VUAPQ9Rny/Z6p9nwcqyRHKGkpPO2GSDBSmjsS3E4RutzYoHmrhhSaXQe35qAfSJa2XOPJ4OQ== X-Received: by 2002:a17:902:7848:: with SMTP id e8mr5423892pln.100.1542777040462; Tue, 20 Nov 2018 21:10:40 -0800 (PST) Received: from localhost.localdomain.localdomain ([103.129.255.252]) by smtp.gmail.com with ESMTPSA id b62-v6sm52846616pfa.159.2018.11.20.21.10.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Nov 2018 21:10:40 -0800 (PST) From: Li Qiang To: armbru@redhat.com, pbonzini@redhat.com, kraxel@redhat.com, lersek@redhat.com, philmd@redhat.com Date: Tue, 20 Nov 2018 21:10:25 -0800 Message-Id: <1542777026-2788-3-git-send-email-liq3ea@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1542777026-2788-1-git-send-email-liq3ea@gmail.com> References: <1542777026-2788-1-git-send-email-liq3ea@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::644 Subject: [Qemu-devel] [PATCH v2 2/3] fw_cfg: fix -boot reboot-timeout error checking X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: liq3ea@gmail.com, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP fw_cfg_reboot() gets option parameter "reboot-timeout" with qemu_opt_get(), then converts it to an integer by hand. It neglects to check that conversion for errors, and fails to reject negative values. Positive values above the limit get reported and replaced by the limit. This patch checks for conversion errors properly, and reject all values outside 0...0xffff. Signed-off-by: Li Qiang Reviewed-by: Markus Armbruster Reviewed-by: Philippe Mathieu-Daudé --- v1->v2: commit typo fix hw/nvram/fw_cfg.c | 27 +++++++++++++-------------- vl.c | 2 +- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c index 83d66818f6..aafa96721f 100644 --- a/hw/nvram/fw_cfg.c +++ b/hw/nvram/fw_cfg.c @@ -177,26 +177,25 @@ static void fw_cfg_bootsplash(FWCfgState *s) static void fw_cfg_reboot(FWCfgState *s) { - int reboot_timeout = -1; - char *p; - const char *temp; + const char *reboot_timeout = NULL; + int64_t rt_val = -1; /* get user configuration */ QemuOptsList *plist = qemu_find_opts("boot-opts"); QemuOpts *opts = QTAILQ_FIRST(&plist->head); - if (opts != NULL) { - temp = qemu_opt_get(opts, "reboot-timeout"); - if (temp != NULL) { - p = (char *)temp; - reboot_timeout = strtol(p, &p, 10); + reboot_timeout = qemu_opt_get(opts, "reboot-timeout"); + + if (reboot_timeout) { + rt_val = qemu_opt_get_number(opts, "reboot-timeout", -1); + /* validate the input */ + if (rt_val < 0 || rt_val > 0xffff) { + error_report("reboot timeout is invalid," + "it should be a value between 0 and 65535"); + exit(1); } } - /* validate the input */ - if (reboot_timeout > 0xffff) { - error_report("reboot timeout is larger than 65535, force it to 65535."); - reboot_timeout = 0xffff; - } - fw_cfg_add_file(s, "etc/boot-fail-wait", g_memdup(&reboot_timeout, 4), 4); + + fw_cfg_add_file(s, "etc/boot-fail-wait", g_memdup(&rt_val, 4), 4); } static void fw_cfg_write(FWCfgState *s, uint8_t value) diff --git a/vl.c b/vl.c index 96ac0ddcf6..38a1759461 100644 --- a/vl.c +++ b/vl.c @@ -339,7 +339,7 @@ static QemuOptsList qemu_boot_opts = { .type = QEMU_OPT_NUMBER, }, { .name = "reboot-timeout", - .type = QEMU_OPT_STRING, + .type = QEMU_OPT_NUMBER, }, { .name = "strict", .type = QEMU_OPT_BOOL, From patchwork Wed Nov 21 05:10:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Li Qiang X-Patchwork-Id: 10691941 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 68F5413BF for ; Wed, 21 Nov 2018 05:12:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 57EF92B6E0 for ; Wed, 21 Nov 2018 05:12:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4BF182B6E6; Wed, 21 Nov 2018 05:12:08 +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=-7.7 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id EB6AF2B6E0 for ; Wed, 21 Nov 2018 05:12:07 +0000 (UTC) Received: from localhost ([::1]:37252 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gPKo3-0004ts-5g for patchwork-qemu-devel@patchwork.kernel.org; Wed, 21 Nov 2018 00:12:07 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43751) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gPKml-00043b-EI for qemu-devel@nongnu.org; Wed, 21 Nov 2018 00:10:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gPKmi-00031M-Bt for qemu-devel@nongnu.org; Wed, 21 Nov 2018 00:10:47 -0500 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]:34989) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gPKmi-0002zh-60 for qemu-devel@nongnu.org; Wed, 21 Nov 2018 00:10:44 -0500 Received: by mail-pl1-x641.google.com with SMTP id v1-v6so3697975plo.2 for ; Tue, 20 Nov 2018 21:10:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=2ddOizbdB6oxBWbDQ3P024m4xfQCg/JY8LWwB7Hpfyc=; b=JbydRuQ6em5ATqT0RuONPbNIBjggbbIfSlG+P1G/vt1b9iUnQzqr2N7cqQjmBCoOhQ T4vcN+xa0r/e5bosF9GwoH/fjq05nqYxJEzjXA8ucOj7pEhxv56WWnrO5tzD4egDQWW6 rFmK+fzwf2uTZbSWVsEXa2dBmV0yCpineVg3ByfoKRx1QHbN06re5hsFbEpyHY/UMfN/ /g/+6nUWS1RLfZEZh080R80m4CBmgh4lzKQt90kV4QeRDKz2p1PgrA4ZJSXnQFvBIlaF zKgfMTiJ5WbV8MsFjqC3x/kvd+51+Eh0kxJduG5aEVzjuBKhTxj2qeO2nmSXWWBdUPaH 9ETQ== 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:in-reply-to :references; bh=2ddOizbdB6oxBWbDQ3P024m4xfQCg/JY8LWwB7Hpfyc=; b=A+iSsvK+4/YgCKA+66n1qdI0oyglEim6LEeiXeL5qLW7ynZsKNir0Ify24T/rbz/8z wnnkLWDNYZS6xyVeA5XxbbbJqI4zmqsVClaOG/JB2A21dejrPOEi0/6tYvNVHCRuh2z5 Z6U8lbdA9qfOHlWqwaLI51/7P5Bf1CO1EN8mBjJScSLxvDRfn/oviFAxBmAe1gG1Vhnk 614vgjKvYxoJ2QqYoluRg4dYBgLI+17SKKoTdbIYACAE6cnZuIEtzwR5tKduerQwPwRr seE/EUvwVyuf08YB35bxaPV4nix0Nx1Wek1gboPrvhFd0xe6Fn66xDe3M4FP7M/jddqC asaQ== X-Gm-Message-State: AA+aEWbkf2mP0PVLFHdDSXFPpYc5ehaVPmJqze80aoTyyS7EKyR5AK6+ afoZqOHrXLrgzuzMJZeCRM4= X-Google-Smtp-Source: AFSGD/WtdruIjPBEvEp3GLOHdvFZR5ErfHqTYpWEcjWN93NrCPQJJAl6Jpkq7O4cWDCm14msIOU1RQ== X-Received: by 2002:a17:902:a710:: with SMTP id w16mr5168240plq.95.1542777043244; Tue, 20 Nov 2018 21:10:43 -0800 (PST) Received: from localhost.localdomain.localdomain ([103.129.255.252]) by smtp.gmail.com with ESMTPSA id b62-v6sm52846616pfa.159.2018.11.20.21.10.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Nov 2018 21:10:42 -0800 (PST) From: Li Qiang To: armbru@redhat.com, pbonzini@redhat.com, kraxel@redhat.com, lersek@redhat.com, philmd@redhat.com Date: Tue, 20 Nov 2018 21:10:26 -0800 Message-Id: <1542777026-2788-4-git-send-email-liq3ea@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1542777026-2788-1-git-send-email-liq3ea@gmail.com> References: <1542777026-2788-1-git-send-email-liq3ea@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::641 Subject: [Qemu-devel] [PATCH v2 3/3] fw_cfg: make qemu_extra_params_fw locally X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: liq3ea@gmail.com, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP qemu_extra_params_fw[] has external linkage, but is used only in fw_cfg_bootsplash(), it makes sense to make it locally. Signed-off-by: Li Qiang Reviewed-by: Markus Armbruster Reviewed-by: Philippe Mathieu-Daudé --- hw/nvram/fw_cfg.c | 1 + include/sysemu/sysemu.h | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c index aafa96721f..a71f043b5d 100644 --- a/hw/nvram/fw_cfg.c +++ b/hw/nvram/fw_cfg.c @@ -120,6 +120,7 @@ static void fw_cfg_bootsplash(FWCfgState *s) { const char *boot_splash_filename = NULL; const char *boot_splash_time = NULL; + uint8_t qemu_extra_params_fw[2]; char *filename, *file_data; gsize file_size; int file_type; diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h index 8d6095d98b..f8608d24d9 100644 --- a/include/sysemu/sysemu.h +++ b/include/sysemu/sysemu.h @@ -133,7 +133,6 @@ extern uint8_t *boot_splash_filedata; extern size_t boot_splash_filedata_size; extern bool enable_mlock; extern bool enable_cpu_pm; -extern uint8_t qemu_extra_params_fw[2]; extern QEMUClockType rtc_clock; extern const char *mem_path; extern int mem_prealloc;