From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53203) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VVy8H-0001v5-DU for qemu-devel@nongnu.org; Tue, 15 Oct 2013 02:29:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VVy8B-0005S8-FD for qemu-devel@nongnu.org; Tue, 15 Oct 2013 02:29:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49417) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VVy8B-0005Rr-5f for qemu-devel@nongnu.org; Tue, 15 Oct 2013 02:29:23 -0400 Date: Tue, 15 Oct 2013 09:31:53 +0300 From: "Michael S. Tsirkin" Message-ID: <1381818560-18367-27-git-send-email-mst@redhat.com> References: <1381818560-18367-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1381818560-18367-1-git-send-email-mst@redhat.com> Subject: [Qemu-devel] [PULL v2 26/39] loader: use file path size from fw_cfg.h List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, Anthony Liguori Cc: peter.maydell@linaro.org, mst@redhat.com, marcel.a@redhat.com, kraxel@redhat.com, imammedo@redhat.com, Laszlo Ersek Avoid a bit of code duplication, make max file path constant reusable. Suggested-by: Laszlo Ersek Reviewed-by: Gerd Hoffmann Tested-by: Gerd Hoffmann Reviewed-by: Igor Mammedov Tested-by: Igor Mammedov 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, '/'); -- MST