Re: [PATCH 5/6] treewide: use kv[mz]alloc* rather than opencoded variants
From: Christian Borntraeger <hidden>
Date: 2017-01-12 16:06:16
Also in:
linux-mm, lkml
From: Christian Borntraeger <hidden>
Date: 2017-01-12 16:06:16
Also in:
linux-mm, lkml
On 01/12/2017 04:37 PM, Michal Hocko wrote:
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c index 4f74511015b8..e6bbb33d2956 100644 --- a/arch/s390/kvm/kvm-s390.c +++ b/arch/s390/kvm/kvm-s390.c@@ -1126,10 +1126,7 @@ static long kvm_s390_get_skeys(struct kvm *kvm, struct kvm_s390_skeys *args) if (args->count < 1 || args->count > KVM_S390_SKEYS_MAX) return -EINVAL; - keys = kmalloc_array(args->count, sizeof(uint8_t), - GFP_KERNEL | __GFP_NOWARN); - if (!keys) - keys = vmalloc(sizeof(uint8_t) * args->count); + keys = kvmalloc(args->count * sizeof(uint8_t), GFP_KERNEL); if (!keys) return -ENOMEM;@@ -1171,10 +1168,7 @@ static long kvm_s390_set_skeys(struct kvm *kvm, struct kvm_s390_skeys *args) if (args->count < 1 || args->count > KVM_S390_SKEYS_MAX) return -EINVAL; - keys = kmalloc_array(args->count, sizeof(uint8_t), - GFP_KERNEL | __GFP_NOWARN); - if (!keys) - keys = vmalloc(sizeof(uint8_t) * args->count); + keys = kvmalloc(sizeof(uint8_t) * args->count, GFP_KERNEL); if (!keys) return -ENOMEM;
KVM/s390 parts Acked-by: Christian Borntraeger <redacted>