[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] block: vhdx - fix reading beyond pointer during
From: |
Markus Armbruster |
Subject: |
Re: [Qemu-devel] [PATCH] block: vhdx - fix reading beyond pointer during image creation |
Date: |
Thu, 18 Sep 2014 09:43:14 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
Markus Armbruster <address@hidden> writes:
> Jeff Cody <address@hidden> writes:
>
>> On Wed, Sep 17, 2014 at 08:33:10AM +0200, Markus Armbruster wrote:
>>> Jeff Cody <address@hidden> writes:
>>>
>>> > In vhdx_create_metadata(), we allocate 40 bytes to entry_buffer for
>>> > the various metadata table entries. However, we write out 64kB from
>>> > that buffer into the new file. Only write out the correct 40 bytes.
>>> >
>>> > Signed-off-by: Jeff Cody <address@hidden>
>>> > ---
>>> > block/vhdx.c | 16 ++++++++--------
>>> > 1 file changed, 8 insertions(+), 8 deletions(-)
>>> >
>>> > diff --git a/block/vhdx.c b/block/vhdx.c
>>> > index 796b7bd..b52ec32 100644
>>> > --- a/block/vhdx.c
>>> > +++ b/block/vhdx.c
>>> > @@ -1407,6 +1407,12 @@ exit:
>>> > return ret;
>>> > }
>>> >
>>> > +#define VHDX_METADATA_ENTRY_BUFFER_SIZE \
>>> > + (sizeof(VHDXFileParameters)
>>> > +\
>>> > + sizeof(VHDXVirtualDiskSize)
>>> > +\
>>> > + sizeof(VHDXPage83Data)
>>> > +\
>>> > +
>>> > sizeof(VHDXVirtualDiskLogicalSectorSize) +\
>>> > +
>>> > sizeof(VHDXVirtualDiskPhysicalSectorSize))
>>>
>>> Long lines, caused by excessive indentation. Emacs suggests
>>>
>>> #define VHDX_METADATA_ENTRY_BUFFER_SIZE \
>>> (sizeof(VHDXFileParameters) + \
>>> sizeof(VHDXVirtualDiskSize) + \
>>> sizeof(VHDXPage83Data) + \
>>> sizeof(VHDXVirtualDiskLogicalSectorSize) + \
>>> sizeof(VHDXVirtualDiskPhysicalSectorSize))
>>>
>>
>> So, I was getting ready to respin this, but double checked the patch -
>> it shows the lines ending on column 80 (as intended), and
>> checkpatch.pl had no issue with it. Did you accidentally (or
>> intentionally!) count the leading '+' of the patch itself?
>
> I didn't count anything, I trusted my eyes, which screamed "ugly!" :)
Forgot to say: since checkpatch is happy, I guess this is a technically
a matter of taste, so
Reviewed-by: Markus Armbruster <address@hidden>
Just in case you actually *like* hanging your code right off the right
margin of the window. *Shudder* ;-P