block/vpc: Make vpc_open() read the full dynamic header
commit02df95c4a1746aac168dc70a6d8aec062e3f6250
authorMarkus Armbruster <armbru@redhat.com>
Thu, 17 Dec 2020 16:19:55 +0000 (17 17:19 +0100)
committerKevin Wolf <kwolf@redhat.com>
Fri, 18 Dec 2020 11:42:34 +0000 (18 12:42 +0100)
treef6415ca296e20f7dad8a4c680875cfd9daa88ef7
parent1a35110150e38beea15865f886022fe329028e12
block/vpc: Make vpc_open() read the full dynamic header

The dynamic header's size is 1024 bytes.

vpc_open() reads only the 512 bytes of the dynamic header into buf[].
Works, because it doesn't actually access the second half.  However, a
colleague told me that GCC 11 warns:

    ../block/vpc.c:358:51: error: array subscript 'struct VHDDynDiskHeader[0]' is partly outside array bounds of 'uint8_t[512]' [-Werror=array-bounds]

Clean up to read the full header.

Rename buf[] to dyndisk_header_buf[] while there.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20201217162003.1102738-2-armbru@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block/vpc.c