Re: [PATCH] x86: kvm: mmu: check result of register_shrinker()

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

 



On 12/21/2017 02:57 PM, Paolo Bonzini wrote:

> On 21/12/2017 12:19, Aliaksei Karaliou wrote:
>> kvm_mmu_module_init() does not check result of register_shrinker()
>> which was tagged as __must_check recently, reported by sparse.
>>
>> Signed-off-by: Aliaksei Karaliou <akaraliou.dev@xxxxxxxxx>
>> ---
>>  arch/x86/kvm/mmu.c | 5 ++++-
>>  1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
>> index 89da688..917ffaf 100644
>> --- a/arch/x86/kvm/mmu.c
>> +++ b/arch/x86/kvm/mmu.c
>> @@ -5482,10 +5482,13 @@ int kvm_mmu_module_init(void)
>>  	if (percpu_counter_init(&kvm_total_used_mmu_pages, 0, GFP_KERNEL))
>>  		goto nomem;
>>  
>> -	register_shrinker(&mmu_shrinker);
>> +	if (register_shrinker(&mmu_shrinker))
>> +		goto nomem_free_counter;
>>  
>>  	return 0;
>>  
>> +nomem_free_counter:
>> +	percpu_counter_destroy(&kvm_total_used_mmu_pages);
>>  nomem:
>>  	mmu_destroy_caches();
>>  	return -ENOMEM;
>>
> Hi, I think a similar patch has already been queued by Andrew Morton.
>
> Thanks,
>
> Paolo
Yeah, I sincerely apologize, similar one was already made by Tetsuo Handa -
https://marc.info/?l=kvm&m=151196211209775&w=2

Best regards,
    Aliaksei.



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux