On 12.02.2021 16:39, Andrew Cooper wrote:
> Various version of gcc, when compiling with -Og, complain:
>
> xg_sr_common_x86.c: In function 'write_x86_cpu_policy_records':
> xg_sr_common_x86.c:92:12: error: 'rc' may be used uninitialized in this
> function [-Werror=maybe-uninitialized]
> 92 | return rc;
> | ^~
>
> The complaint is legitimate, and can occur with unexpected behaviour of two
> related hypercalls in combination with a libc which permits zero-length
> malloc()s.
>
> Have an explicit rc = 0 on the success path, and make the MSRs record error
> handling consistent with the CPUID record before it.
>
> Fixes: f6b2b8ec53d ("libxc/save: Write X86_{CPUID,MSR}_DATA records")
> Signed-off-by: Andrew Cooper <[email protected]>
Reviewed-by: Jan Beulich <[email protected]>