From patchwork Wed Jul 24 16:01:52 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 261465 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 6B1422C00A8 for ; Thu, 25 Jul 2013 02:48:53 +1000 (EST) Received: from localhost ([::1]:33454 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V21Wn-00053r-5w for incoming@patchwork.ozlabs.org; Wed, 24 Jul 2013 12:03:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40441) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V21UX-00020A-Ob for qemu-devel@nongnu.org; Wed, 24 Jul 2013 12:00:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V21UR-0002L4-43 for qemu-devel@nongnu.org; Wed, 24 Jul 2013 12:00:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:23056) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V21UQ-0002Kr-R4 for qemu-devel@nongnu.org; Wed, 24 Jul 2013 12:00:35 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r6OG0UgQ020513 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 24 Jul 2013 12:00:34 -0400 Received: from redhat.com (vpn-201-81.tlv.redhat.com [10.35.201.81]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id r6OG0SAv006573 for ; Wed, 24 Jul 2013 12:00:29 -0400 Date: Wed, 24 Jul 2013 19:01:52 +0300 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Message-ID: <1374681580-17439-6-git-send-email-mst@redhat.com> References: <1374681580-17439-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1374681580-17439-1-git-send-email-mst@redhat.com> X-Mutt-Fcc: =sent X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 05/14] 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 Signed-off-by: Michael S. Tsirkin Reviewed-by: Andreas Färber Reviewed-by: Gerd Hoffmann --- hw/core/loader.c | 2 +- include/hw/nvram/fw_cfg.h | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/hw/core/loader.c b/hw/core/loader.c index c3c28cf..c4dd665 100644 --- a/hw/core/loader.c +++ b/hw/core/loader.c @@ -645,7 +645,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]; basename = strrchr(rom->fw_file, '/'); if (basename) { diff --git a/include/hw/nvram/fw_cfg.h b/include/hw/nvram/fw_cfg.h index f60dd67..fa5c8c6 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 {