Skip to content
  • Richard W.M. Jones's avatar
    vddk: Don't use uninitialized values when computing preferred block size · 31bc5322
    Richard W.M. Jones authored
    Commit 63d2dd2e ("vddk: Export block size information for this
    plugin") tried to calculate the preferred block size from the logical
    and physical sector size reported by VDDK.  Unfortunately VDDK < 7’s
    VixDiskLib_GetInfo API returns a struct which does not contain
    these fields at all.  We knew about this already because the
    debug code does not print them, but the block size code uses
    them regardless of the VDDK version.
    
    The practical result of this error was that sometimes (depending on
    existing contents of memory) you would see the error:
    
    nbdkit: vddk[1]: error: plugin must set preferred block size to a power of 2
    
    Fix this by only using the fields when VDDK >= 7, and in earlier
    versions assuming VDDK’s normal sector size.
    
    Reported-by: Xiaodai Wang
    Fixes: commit 63d2dd2e
    Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2066655
    31bc5322