From patchwork Mon Oct 7 09:36:00 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 281029 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 61A3E2C00B7 for ; Mon, 7 Oct 2013 20:38:40 +1100 (EST) Received: from localhost ([::1]:58323 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VT7Gv-00019Q-NG for incoming@patchwork.ozlabs.org; Mon, 07 Oct 2013 05:38:37 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43891) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VT7CC-0003a6-En for qemu-devel@nongnu.org; Mon, 07 Oct 2013 05:33:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VT7C6-0000ty-DZ for qemu-devel@nongnu.org; Mon, 07 Oct 2013 05:33:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:7207) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VT7C6-0000tr-6m for qemu-devel@nongnu.org; Mon, 07 Oct 2013 05:33:38 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r979XaoP014280 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 7 Oct 2013 05:33:36 -0400 Received: from redhat.com (vpn1-7-45.ams2.redhat.com [10.36.7.45]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with SMTP id r979XWFi004019; Mon, 7 Oct 2013 05:33:33 -0400 Date: Mon, 7 Oct 2013 12:36:00 +0300 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org, Anthony Liguori Message-ID: <1381138458-6848-16-git-send-email-mst@redhat.com> References: <1381138458-6848-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1381138458-6848-1-git-send-email-mst@redhat.com> X-Mutt-Fcc: =sent X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: pbonzini@redhat.com, imammedo@redhat.com, Laszlo Ersek , afaerber@suse.de, kraxel@redhat.com Subject: [Qemu-devel] [PATCH v9 15/27] loader: use file path size from fw_cfg.h X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Avoid a bit of code duplication, make max file path constant reusable. Suggested-by: Laszlo Ersek Reviewed-by: Gerd Hoffmann Tested-by: Gerd Hoffmann Signed-off-by: Michael S. Tsirkin --- include/hw/nvram/fw_cfg.h | 4 +++- hw/core/loader.c | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/include/hw/nvram/fw_cfg.h b/include/hw/nvram/fw_cfg.h index 2ab0fc2..72b1549 100644 --- a/include/hw/nvram/fw_cfg.h +++ b/include/hw/nvram/fw_cfg.h @@ -46,12 +46,14 @@ #define FW_CFG_INVALID 0xffff +#define FW_CFG_MAX_FILE_PATH 56 + #ifndef NO_QEMU_PROTOS typedef struct FWCfgFile { uint32_t size; /* file size */ uint16_t select; /* write this to 0x510 to read it */ uint16_t reserved; - char name[56]; + char name[FW_CFG_MAX_FILE_PATH]; } FWCfgFile; typedef struct FWCfgFiles { diff --git a/hw/core/loader.c b/hw/core/loader.c index 449bd4c..060729f 100644 --- a/hw/core/loader.c +++ b/hw/core/loader.c @@ -663,7 +663,7 @@ int rom_add_file(const char *file, const char *fw_dir, rom_insert(rom); if (rom->fw_file && fw_cfg) { const char *basename; - char fw_file_name[56]; + char fw_file_name[FW_CFG_MAX_FILE_PATH]; void *data; basename = strrchr(rom->fw_file, '/');