Hi, Valgrind is not happy with how we're using KVM functions that receives a parameter via reference and write them. This results in a lot of complaints about uninitialized values when using these functions because, as default, Valgrind doesn't know that the variable is being initialized in the function.
This is the overall pattern that Valgrind does not like: --- uint64_t val; (...) kvm_get_one_reg(...., &val); if (val) {...} --- Valgrind complains that the 'if' clause is using an uninitialized variable. A quick fix is to init 'val' and be done with it. The drawback is that every single caller of kvm_get_one_reg() must also be bothered with initializing these variables to avoid the warnings. David suggested in [1] that, instead, we should add a Valgrind hint in the common KVM functions to fix this issue for everyone. This is what this patch accomplishes. kvm_get_one_reg() has 20+ callers so I believe this extra boilerplate is worth the benefits. There are more common instances of KVM functions that Valgrind complains about. If we're good with the approach taken here we can think about adding this hint for more functions. [1] https://lists.gnu.org/archive/html/qemu-devel/2022-03/msg07351.html Daniel Henrique Barboza (1): kvm-all.c: hint Valgrind that kvm_get_one_reg() inits memory accel/kvm/kvm-all.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) -- 2.35.1