On Thu, Mar 20, 2025 at 04:16:59PM -0600, Jim Fehlig via Devel wrote:
> Commit f0169f4d caused a build failure with CLang due to potentially
> uninitialized variable
>
> ../src/qemu/qemu_migration_params.c:825:17: error: variable 'nchannels'
> is used uninitialized whenever '&&' condition is false
> [-Werror,-Wsometimes-uninitialized]
> 825 | if (params && virTypedParamsGetInt(params, nparams,
> | ^~~~~~
> ../src/qemu/qemu_migration_params.c:830:17: note: uninitialized use occurs
> here
> 830 | if (nchannels < 1) {
> | ^~~~~~~~~
>
> Initialize the number of channels to 1, the default value when the
> number of channels is not specified.
>
> Fixes: f0169f4d6ce3915cf70bc3e21fa874369e22c840
> Signed-off-by: Jim Fehlig <[email protected]>
> ---
>
> Is it valid to specify '--parallel' without '--parallel-channels'? If so,
> should the number of channels default to 1?
I've posted a patch series addressing this issue by removing --parallel
option completely including the VIR_DOMAIN_SAVE_PARALLEL flag.
IMHO there is no need to have --parallel option and VIR_DOMAIN_SAVE_PARALLEL
flag,
for more details see the reasoning in the specific patches.
Pavel
>
> src/qemu/qemu_migration_params.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/qemu/qemu_migration_params.c
> b/src/qemu/qemu_migration_params.c
> index b696b0d13e..f8b9e2bd7e 100644
> --- a/src/qemu/qemu_migration_params.c
> +++ b/src/qemu/qemu_migration_params.c
> @@ -820,7 +820,7 @@ qemuMigrationParamsForSave(virTypedParameterPtr params,
> return NULL;
>
> if (flags & VIR_DOMAIN_SAVE_PARALLEL) {
> - int nchannels;
> + int nchannels = 1;
>
> if (params && virTypedParamsGetInt(params, nparams,
>
> VIR_DOMAIN_SAVE_PARAM_PARALLEL_CHANNELS,
> --
> 2.43.0
>
signature.asc
Description: PGP signature
