[libvirt PATCHv2] storagefile: set size field of ploop to 8

Ján Tomko posted 1 patch 1 year, 10 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/af9d22eda637fa8225a4b386e69e2031035a761f.1655897391.git.jtomko@redhat.com
src/storage_file/storage_file_probe.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[libvirt PATCHv2] storagefile: set size field of ploop to 8
Posted by Ján Tomko 1 year, 10 months ago
For all file formats, the length of the size field is assumed
and hardcoded to be 8 bytes.

Fix the length for the ploop format - since we specify the offset,
we read 8 bytes of the length, not 0.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
---
 src/storage_file/storage_file_probe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/storage_file/storage_file_probe.c b/src/storage_file/storage_file_probe.c
index 54e095ffd3..9465af5d96 100644
--- a/src/storage_file/storage_file_probe.c
+++ b/src/storage_file/storage_file_probe.c
@@ -296,7 +296,7 @@ static struct FileTypeInfo const fileTypeInfo[] = {
     [VIR_STORAGE_FILE_VHD] = { 0, NULL, LV_LITTLE_ENDIAN,
                                -1, 0, {0}, 0, 0, 0, NULL, NULL, NULL, NULL },
     [VIR_STORAGE_FILE_PLOOP] = { 0, "WithouFreSpacExt", LV_LITTLE_ENDIAN,
-                                 -2, 0, {0}, PLOOP_IMAGE_SIZE_OFFSET, 0,
+                                 -2, 0, {0}, PLOOP_IMAGE_SIZE_OFFSET, 8,
                                  PLOOP_SIZE_MULTIPLIER, NULL, NULL, NULL, NULL },
 
     /* All formats with a backing store probe below here */
-- 
2.34.1

Re: [libvirt PATCHv2] storagefile: set size field of ploop to 8
Posted by Michal Prívozník 1 year, 10 months ago
On 6/22/22 13:29, Ján Tomko wrote:
> For all file formats, the length of the size field is assumed
> and hardcoded to be 8 bytes.
> 
> Fix the length for the ploop format - since we specify the offset,
> we read 8 bytes of the length, not 0.
> 
> Signed-off-by: Ján Tomko <jtomko@redhat.com>
> ---
>  src/storage_file/storage_file_probe.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>

Michal