[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 5/6] block: mirror - change string allocation
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [PATCH v2 5/6] block: mirror - change string allocation to 2-bytes |
Date: |
Thu, 22 Jan 2015 11:41:04 +0000 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
On Tue, Jan 20, 2015 at 12:31:32PM -0500, Jeff Cody wrote:
> The backing_filename string in mirror_run() is only used to check
> for a NULL string, so we don't need to allocate 1024 bytes (or, later,
> PATH_MAX bytes), when we only need to copy the first 2 characters.
>
> We technically only need 1 byte, as we are just checking for NULL, but
> since backing_filename[] is populated by bdrv_get_backing_filename(), a
> string size of 1 will always only return '\0';
>
> Signed-off-by: Jeff Cody <address@hidden>
> ---
> block/mirror.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
Reviewed-by: Stefan Hajnoczi <address@hidden>
pgp9ko5YhX6bG.pgp
Description: PGP signature
- Re: [Qemu-devel] [PATCH v2 2/6] block: vmdk - move string allocations from stack to the heap, (continued)
- [Qemu-devel] [PATCH v2 3/6] block: qapi - move string allocation from stack to the heap, Jeff Cody, 2015/01/20
- [Qemu-devel] [PATCH v2 4/6] block: move string allocation from stack to the heap, Jeff Cody, 2015/01/20
- [Qemu-devel] [PATCH v2 5/6] block: mirror - change string allocation to 2-bytes, Jeff Cody, 2015/01/20
- [Qemu-devel] [PATCH v2 1/6] block: vmdk - make ret variable usage clear, Jeff Cody, 2015/01/20
- [Qemu-devel] [PATCH v2 6/6] block: update string sizes for filename, backing_file, exact_filename, Jeff Cody, 2015/01/20