Patch "KVM: selftests: Add 'malloc' failure check in vcpu_save_state" has been added to the 6.3-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    KVM: selftests: Add 'malloc' failure check in vcpu_save_state

to the 6.3-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     kvm-selftests-add-malloc-failure-check-in-vcpu_save_.patch
and it can be found in the queue-6.3 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 6ff036b60f2b1f338b2997945f1e36079844f0aa
Author: Ivan Orlov <ivan.orlov0322@xxxxxxxxx>
Date:   Wed Mar 22 18:45:28 2023 +0400

    KVM: selftests: Add 'malloc' failure check in vcpu_save_state
    
    [ Upstream commit 735b0e0f2d001b7ed9486db84453fb860e764a4d ]
    
    There is a 'malloc' call in vcpu_save_state function, which can
    be unsuccessful. This patch will add the malloc failure checking
    to avoid possible null dereference and give more information
    about test fail reasons.
    
    Signed-off-by: Ivan Orlov <ivan.orlov0322@xxxxxxxxx>
    Link: https://lore.kernel.org/r/20230322144528.704077-1-ivan.orlov0322@xxxxxxxxx
    Signed-off-by: Sean Christopherson <seanjc@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/tools/testing/selftests/kvm/lib/x86_64/processor.c b/tools/testing/selftests/kvm/lib/x86_64/processor.c
index c39a4353ba194..827647ff3d41b 100644
--- a/tools/testing/selftests/kvm/lib/x86_64/processor.c
+++ b/tools/testing/selftests/kvm/lib/x86_64/processor.c
@@ -954,6 +954,7 @@ struct kvm_x86_state *vcpu_save_state(struct kvm_vcpu *vcpu)
 	vcpu_run_complete_io(vcpu);
 
 	state = malloc(sizeof(*state) + msr_list->nmsrs * sizeof(state->msrs.entries[0]));
+	TEST_ASSERT(state, "-ENOMEM when allocating kvm state");
 
 	vcpu_events_get(vcpu, &state->events);
 	vcpu_mp_state_get(vcpu, &state->mp_state);



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux