From patchwork Tue Jan 13 17:03:30 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Cody X-Patchwork-Id: 428536 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 987471401DA for ; Wed, 14 Jan 2015 04:08:58 +1100 (AEDT) Received: from localhost ([::1]:40415 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YB4xb-0000Yt-LN for incoming@patchwork.ozlabs.org; Tue, 13 Jan 2015 12:08:55 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43185) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YB4sb-0000lq-3T for qemu-devel@nongnu.org; Tue, 13 Jan 2015 12:03:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YB4sR-0005SG-Cz for qemu-devel@nongnu.org; Tue, 13 Jan 2015 12:03:45 -0500 Received: from mx1.redhat.com ([209.132.183.28]:41939) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YB4sR-0005S0-5u for qemu-devel@nongnu.org; Tue, 13 Jan 2015 12:03:35 -0500 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 t0DH3XVW006170 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Tue, 13 Jan 2015 12:03:33 -0500 Received: from localhost (ovpn-112-98.phx2.redhat.com [10.3.112.98]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t0DH3VvQ019918 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=NO); Tue, 13 Jan 2015 12:03:32 -0500 From: Jeff Cody To: qemu-devel@nongnu.org Date: Tue, 13 Jan 2015 12:03:30 -0500 Message-Id: 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 Cc: kwolf@redhat.com, famz@redhat.com, stefanha@redhat.com, mreitz@redhat.com Subject: [Qemu-devel] [PATCH] block: update string sizes for filename, backing_file, exact_filename 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 The string field entries 'filename', 'backing_file', and 'exact_filename' in the BlockDriverState struct are defined as 1024 bytes. However, most places that use these values accept a maximum of PATH_MAX bytes. This patch makes the BlockDriverStruct field string sizes match the most common usage. This patch also updates two block drivers that still use 1024-byte sized arrays for 'backing_file'. Signed-off-by: Jeff Cody --- block/mirror.c | 2 +- block/qapi.c | 2 +- include/block/block_int.h | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/block/mirror.c b/block/mirror.c index 9019d1b..57154eb 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -378,7 +378,7 @@ static void coroutine_fn mirror_run(void *opaque) int64_t sector_num, end, sectors_per_chunk, length; uint64_t last_pause_ns; BlockDriverInfo bdi; - char backing_filename[1024]; + char backing_filename[PATH_MAX]; int ret = 0; int n; diff --git a/block/qapi.c b/block/qapi.c index a6fd6f7..c097238 100644 --- a/block/qapi.c +++ b/block/qapi.c @@ -175,7 +175,7 @@ void bdrv_query_image_info(BlockDriverState *bs, { int64_t size; const char *backing_filename; - char backing_filename2[1024]; + char backing_filename2[PATH_MAX]; BlockDriverInfo bdi; int ret; Error *err = NULL; diff --git a/include/block/block_int.h b/include/block/block_int.h index 06a21dd..e264be9 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -339,13 +339,13 @@ struct BlockDriverState { * regarding this BDS's context */ QLIST_HEAD(, BdrvAioNotifier) aio_notifiers; - char filename[1024]; - char backing_file[1024]; /* if non zero, the image is a diff of - this file image */ + char filename[PATH_MAX]; + char backing_file[PATH_MAX]; /* if non zero, the image is a diff of + this file image */ char backing_format[16]; /* if non-zero and backing_file exists */ QDict *full_open_options; - char exact_filename[1024]; + char exact_filename[PATH_MAX]; BlockDriverState *backing_hd; BlockDriverState *file;