Received: by 2002:a05:6358:16cd:b0:dc:6189:e246 with SMTP id r13csp179569rwl; Thu, 3 Nov 2022 21:53:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6kSytFZwWeTXkQHc2CYhsTaoIkJmBwj1JpOD61v3seQcB9hElr9fqEaa+01+s1JrLsmbBu X-Received: by 2002:a05:6402:12d1:b0:463:3f0c:be02 with SMTP id k17-20020a05640212d100b004633f0cbe02mr27347042edx.239.1667537628522; Thu, 03 Nov 2022 21:53:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667537628; cv=none; d=google.com; s=arc-20160816; b=I8tutRc2l6Gxb99BQEMQDrmXi50iKY7BsvJ+QjyWZt7rogjKnEVeFw8/QgW3fHxjxG EoTt6X6QpjHv191yC0r1BtswCD+nmdIzrfqVkWNP+UNUccXvJuQ2PjWJUHC+YRKIubnO +0GsC1cyEnVDV6fSGRtJYo+mJxoD37kFKs2xmGqyjdc4SUkFZpFOOIpYWqCFe9W1wxLw LeUFKMlne3R91Sv8z4iCjUXuIt1pLgcyxFLMXwPklsbZeW14C7sFZTd8KSsetnIBniSm 9WaHHaJHuwtbdVQkvWzYGhfmv2VhsjPcV3RUIZgn4tI3vy1gblYw7tJ2lD9mAsScZYpt LIuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:subject:user-agent:mime-version:date:message-id; bh=lZGpJIkys0t3/jTsX4TF9chEaZ+lKE2DrynnmdnwP/c=; b=FNZjsXfMt9dUkM1oi0Bkf3nrnCr+kvCdvu9KLQVXXJNkey8Pys59v0HCMU9C3HCsdJ 7wT4e83CwmR5KdUorRsifrdvrhL5Yhwj7xt+ihri+qutEaQ7a6d3wwkOttuAmjpC++Df dBXikAIQlreU3W/PAArGI0EX52ES/eHMV11Dm9Sc5P5uf3bZab08FfTx0J0BJSezwEmI b0kvSVWZcku8kTNYgvwpVAXrQlWXi8YT6t0nVl9TY3DY6oM+XEJEstgDT9DiI1w+wC3e PYsD1yeVEGEdEk1blXmvmDcHN8Z0AoHvkY+ymwIKNUGJifZb/IdRdP0KkFRJqcqBuubP PC+g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w15-20020a05640234cf00b004618ed2dfe2si4681400edc.6.2022.11.03.21.53.26; Thu, 03 Nov 2022 21:53:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230382AbiKDEGS (ORCPT + 95 others); Fri, 4 Nov 2022 00:06:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230370AbiKDEGM (ORCPT ); Fri, 4 Nov 2022 00:06:12 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EFC7F20F50; Thu, 3 Nov 2022 21:06:07 -0700 (PDT) Received: from kwepemi500012.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4N3Rqs42W0zHvSv; Fri, 4 Nov 2022 12:05:45 +0800 (CST) Received: from [10.67.110.108] (10.67.110.108) by kwepemi500012.china.huawei.com (7.221.188.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 4 Nov 2022 12:06:05 +0800 Message-ID: <025f1f44-54fa-cc01-96e3-bf0b33d27365@huawei.com> Date: Fri, 4 Nov 2022 12:06:04 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.4.0 Subject: Re: [PATCH 2/2] KVM: x86: Fix a typo about the usage of kvcalloc() To: Paolo Bonzini , , , , , , CC: , , , Joe Perches References: <20221103011749.139262-1-liaochang1@huawei.com> <5374345c-7973-6a3c-d559-73bf4ac15079@redhat.com> From: "liaochang (A)" In-Reply-To: <5374345c-7973-6a3c-d559-73bf4ac15079@redhat.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.67.110.108] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemi500012.china.huawei.com (7.221.188.12) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 在 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 >> --- >>   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