lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <025f1f44-54fa-cc01-96e3-bf0b33d27365@huawei.com>
Date:   Fri, 4 Nov 2022 12:06:04 +0800
From:   "liaochang (A)" <liaochang1@...wei.com>
To:     Paolo Bonzini <pbonzini@...hat.com>, <seanjc@...gle.com>,
        <tglx@...utronix.de>, <mingo@...hat.com>, <bp@...en8.de>,
        <dave.hansen@...ux.intel.com>, <hpa@...or.com>
CC:     <x86@...nel.org>, <kvm@...r.kernel.org>,
        <linux-kernel@...r.kernel.org>, Joe Perches <joe@...ches.com>
Subject: Re: [PATCH 2/2] KVM: x86: Fix a typo about the usage of kvcalloc()



在 2022/11/3 21:39, Paolo Bonzini 写道:
> On 11/3/22 02:17, Liao Chang wrote:
>> Swap the 1st and 2nd arguments to be consistent with the usage of
>> kvcalloc().
>>
>> Fixes: c9b8fecddb5b ("KVM: use kvcalloc for array allocations")
>> Signed-off-by: Liao Chang<liaochang1@...wei.com>
>> ---
>>   arch/x86/kvm/cpuid.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
>> index 7065462378e2..b33c18b142c2 100644
>> --- a/arch/x86/kvm/cpuid.c
>> +++ b/arch/x86/kvm/cpuid.c
>> @@ -1331,7 +1331,7 @@ int kvm_dev_ioctl_get_cpuid(struct kvm_cpuid2 *cpuid,
>>       if (sanity_check_entries(entries, cpuid->nent, type))
>>           return -EINVAL;
>>   -    array.entries = kvcalloc(sizeof(struct kvm_cpuid_entry2), cpuid->nent, GFP_KERNEL);
>> +    array.entries = kvcalloc(cpuid->nent, sizeof(struct kvm_cpuid_entry2), GFP_KERNEL);
>>       if (!array.entries)
>>           return -ENOMEM;
>>   
> 
> It doesn't make any difference, but scripts/checkpatch.pl checks it so
> let's fix the sole occurrence in KVM.
> 
> However, please send a patch to scripts/checkpatch.pl to include calloc(),
> kvmalloc_array and kvcalloc() in the matched functions:
> 
> # check for alloc argument mismatch
>                 if ($line =~ /\b((?:devm_)?(?:kcalloc|kmalloc_array))\s*\(\s*sizeof\b/) {
>                         WARN("ALLOC_ARRAY_ARGS",
>                              "$1 uses number as first arg, sizeof is generally wrong\n" . $herecurr);
>                 }

I ready send a patch to enhance the checking for array allocator family,
please check out patch "checkpatch: Add check for array allocator family argument order".

Thanks.

> 
> 
> Paolo
> 
> 
> .

-- 
BR,
Liao, Chang

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ