From nobody Fri May 3 09:50:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1542777270122816.5973118697759; Tue, 20 Nov 2018 21:14:30 -0800 (PST) Received: from localhost ([::1]:37259 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gPKqG-0006st-3e for importer@patchew.org; Wed, 21 Nov 2018 00:14:24 -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) 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) 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) 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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=3DT" 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: Gerd Hoffmann Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- 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: =20 static void fw_cfg_bootsplash(FWCfgState *s) { - int boot_splash_time =3D -1; const char *boot_splash_filename =3D NULL; - char *p; + const char *boot_splash_time =3D NULL; char *filename, *file_data; gsize file_size; int file_type; - const char *temp; =20 /* get user configuration */ QemuOptsList *plist =3D qemu_find_opts("boot-opts"); QemuOpts *opts =3D QTAILQ_FIRST(&plist->head); - if (opts !=3D NULL) { - temp =3D qemu_opt_get(opts, "splash"); - if (temp !=3D NULL) { - boot_splash_filename =3D temp; - } - temp =3D qemu_opt_get(opts, "splash-time"); - if (temp !=3D NULL) { - p =3D (char *)temp; - boot_splash_time =3D strtol(p, &p, 10); - } - } + boot_splash_filename =3D qemu_opt_get(opts, "splash"); + boot_splash_time =3D qemu_opt_get(opts, "splash-time"); =20 /* insert splash time if user configurated */ - if (boot_splash_time >=3D 0) { + if (boot_splash_time) { + int64_t bst_val =3D 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 =3D 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] =3D (uint8_t)(boot_splash_time & 0xff); - qemu_extra_params_fw[1] =3D (uint8_t)((boot_splash_time >> 8) & 0x= ff); + qemu_extra_params_fw[0] =3D (uint8_t)(bst_val & 0xff); + qemu_extra_params_fw[1] =3D (uint8_t)((bst_val >> 8) & 0xff); fw_cfg_add_file(s, "etc/boot-menu-wait", qemu_extra_params_fw, 2); } =20 /* insert splash file if user configurated */ - if (boot_splash_filename !=3D NULL) { + if (boot_splash_filename) { filename =3D qemu_find_file(QEMU_FILE_TYPE_BIOS, boot_splash_filen= ame); if (filename =3D=3D NULL) { - error_report("failed to find file '%s'.", boot_splash_filename= ); + error_report("failed to find file '%s'", boot_splash_filename); return; } =20 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 =3D { .type =3D QEMU_OPT_STRING, }, { .name =3D "splash-time", - .type =3D QEMU_OPT_STRING, + .type =3D QEMU_OPT_NUMBER, }, { .name =3D "reboot-timeout", .type =3D QEMU_OPT_STRING, --=20 2.11.0 From nobody Fri May 3 09:50:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1542777165376960.4145935480291; Tue, 20 Nov 2018 21:12:45 -0800 (PST) Received: from localhost ([::1]:37251 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gPKoQ-0004ny-3x for importer@patchew.org; Wed, 21 Nov 2018 00:12:30 -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) 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) 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) 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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: Gerd Hoffmann Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- 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) =20 static void fw_cfg_reboot(FWCfgState *s) { - int reboot_timeout =3D -1; - char *p; - const char *temp; + const char *reboot_timeout =3D NULL; + int64_t rt_val =3D -1; =20 /* get user configuration */ QemuOptsList *plist =3D qemu_find_opts("boot-opts"); QemuOpts *opts =3D QTAILQ_FIRST(&plist->head); - if (opts !=3D NULL) { - temp =3D qemu_opt_get(opts, "reboot-timeout"); - if (temp !=3D NULL) { - p =3D (char *)temp; - reboot_timeout =3D strtol(p, &p, 10); + reboot_timeout =3D qemu_opt_get(opts, "reboot-timeout"); + + if (reboot_timeout) { + rt_val =3D 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 655= 35."); - reboot_timeout =3D 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); } =20 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 =3D { .type =3D QEMU_OPT_NUMBER, }, { .name =3D "reboot-timeout", - .type =3D QEMU_OPT_STRING, + .type =3D QEMU_OPT_NUMBER, }, { .name =3D "strict", .type =3D QEMU_OPT_BOOL, --=20 2.11.0 From nobody Fri May 3 09:50:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1542777164229547.0732268827894; Tue, 20 Nov 2018 21:12:44 -0800 (PST) Received: from localhost ([::1]:37252 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gPKoY-0004ts-0h for importer@patchew.org; Wed, 21 Nov 2018 00:12:38 -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) 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) 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) 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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: Gerd Hoffmann Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- 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 =3D NULL; const char *boot_splash_time =3D 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; --=20 2.11.0