[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 6/6] block: update string sizes for filename,
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [PATCH v2 6/6] block: update string sizes for filename, backing_file, exact_filename |
Date: |
Thu, 22 Jan 2015 11:46:37 +0000 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
On Tue, Jan 20, 2015 at 12:31:33PM -0500, Jeff Cody wrote:
> The string field entries 'filename', 'backing_file', and
> 'exact_filename' in the BlockDriverState struct are defined as 1024
> bytes.
>
> However, many places that use these values accept a maximum of PATH_MAX
> bytes, so we have a mixture of 1024 byte and PATH_MAX byte allocations.
> This patch makes the BlockDriverStruct field string sizes match usage.
>
> This patch also does a few fixes related to the size that needs to
> happen now:
>
> * the block qapi driver is updated to use PATH_MAX bytes
> * the qcow and qcow2 drivers have an additional safety check
> * the block vvfat driver is updated to use PATH_MAX bytes
> for the size of backing_file, for systems where PATH_MAX is < 1024
> bytes.
> * qemu-img uses PATH_MAX rather than 1024. These instances were not
> changed to be dynamically allocated, however, as the extra
> temporary 3K in stack usage for qemu-img does not seem worrisome.
>
> Signed-off-by: Jeff Cody <address@hidden>
> ---
> block/qapi.c | 4 ++--
> block/qcow.c | 2 +-
> block/qcow2.c | 3 ++-
> block/vvfat.c | 4 ++--
> include/block/block_int.h | 8 ++++----
> qemu-img.c | 4 ++--
> 6 files changed, 13 insertions(+), 12 deletions(-)
Reviewed-by: Stefan Hajnoczi <address@hidden>
pgp6KF0SjMLEg.pgp
Description: PGP signature
- Re: [Qemu-devel] [PATCH v2 4/6] block: move string allocation from stack to the heap, (continued)