From patchwork Thu Nov 3 01:16:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liao Chang X-Patchwork-Id: 14579 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp250154wru; Wed, 2 Nov 2022 18:25:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7i3UCHw2lJ0OPriNYBn0uNRegzxFsTIOEJa8ekmGgW774Q9w6lXvB6fnjrJHGw3XU6g1z5 X-Received: by 2002:a17:906:2c1b:b0:7ad:cf0d:d29a with SMTP id e27-20020a1709062c1b00b007adcf0dd29amr19610974ejh.309.1667438745545; Wed, 02 Nov 2022 18:25:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667438745; cv=none; d=google.com; s=arc-20160816; b=FwVYKEJ8tF++NnLDpYQ6jNW+v81srCnsGpy5Q1nrzUMyx/Sf6J4AGhGCXyNQQJYOf7 NG4OUvXeDG0zkANJxOzVRjvRRzoxCjdq6WGVgUe6De3yLoNJpUErJbXkoi0P7r9nLAxN s1I1uMygDO87vFX+HsyaWoPYmc5hPG2FLWJM4qR18guXKv/m9MDJa2oF5FawqJpx5D2A TTl5L9KxdgVIEPW9atsBbSpr6caBUOBO1s0t+TvMcEuxcDVbLcTID4zj/rewr+pjQV+E XRPvf9l0n7MzRFYIGx52vVA8nRp3gODdynALpefpPS2xTcILe1qwMvT0Zj6hlfoNrj5M wDQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=uvn/wlLzqE8XL8hz85IXkGpKFL+3qFqCBojRgJCWSVk=; b=jAjnJ7gXDJ2EYJ9++NkPjQE9vpsBHrzFaYEdiRnHDy9hXhKyaCGQd8W5cKGI5wpCsV ddtGN4djsO5waPUvjoIuUDJmDK3KZGwlaXITVJ8glwu0lP3M7iXmBVWBqfD42OW80kI8 qIgB6iRZ03yMiWHpCyY/rlz+vtYBTjiFZlB2pi5Ln4gcnQKbPg1IXcbUKCdQT2VTucpB ZEZeUzrC1EmRWDgAg15YLOCDHo0ePzXXxrdqJNYbMlElixQiL8C8R6Wn4lgb6B2EwZ4l ulcj9c6tg2PYxSp2yYIUph2DRDTaDrc2SlfWRLEF1Ozlrk6cKAD7fFrX/T+P3VKPQgFQ 8ZDw== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e14-20020a17090658ce00b007aaacf9c0a1si19862149ejs.129.2022.11.02.18.25.21; Wed, 02 Nov 2022 18:25:45 -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 S229457AbiKCBUF (ORCPT + 99 others); Wed, 2 Nov 2022 21:20:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229598AbiKCBUD (ORCPT ); Wed, 2 Nov 2022 21:20:03 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7862912745 for ; Wed, 2 Nov 2022 18:20:02 -0700 (PDT) Received: from kwepemi500012.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4N2mBz6kbGzbcDF; Thu, 3 Nov 2022 09:19:55 +0800 (CST) Received: from huawei.com (10.67.174.53) 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; Thu, 3 Nov 2022 09:20:00 +0800 From: Liao Chang To: , , , CC: , Subject: [PATCH 1/2] ARM: kprobes: Improve robustness for kprobe coverage testing Date: Thu, 3 Nov 2022 09:16:45 +0800 Message-ID: <20221103011645.138749-1-liaochang1@huawei.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-Originating-IP: [10.67.174.53] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) 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,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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748436249649775781?= X-GMAIL-MSGID: =?utf-8?q?1748436249649775781?= Improve robustness for kprobe coverage testing, avoid to access NULL pointer in coverage_start_fn. Fixes: 963780dfe390 ("ARM: kprobes: Add decoding table test coverage analysis") Signed-off-by: Liao Chang --- arch/arm/probes/kprobes/test-core.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/arm/probes/kprobes/test-core.c b/arch/arm/probes/kprobes/test-core.c index c562832b8627..e6a932e863bb 100644 --- a/arch/arm/probes/kprobes/test-core.c +++ b/arch/arm/probes/kprobes/test-core.c @@ -766,6 +766,11 @@ static int coverage_start(const union decode_item *table) coverage.base = kmalloc_array(MAX_COVERAGE_ENTRIES, sizeof(struct coverage_entry), GFP_KERNEL); + if (!coverage.base) { + pr_err("FAIL: Out of space for allocating coverage entries"); + return -ENOMEM; + } + coverage.num_entries = 0; coverage.nesting = 0; return table_iter(table, coverage_start_fn, &coverage); From patchwork Thu Nov 3 01:17:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liao Chang X-Patchwork-Id: 14580 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp250367wru; Wed, 2 Nov 2022 18:26:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4331JSZQuwIX7HmQz43AFxAV9FjIeiQ/r6PxxypSiCImT2zEguDxoY5h4TqxXR0crzOjmc X-Received: by 2002:a17:907:8a24:b0:78d:cd60:1022 with SMTP id sc36-20020a1709078a2400b0078dcd601022mr26380993ejc.384.1667438780861; Wed, 02 Nov 2022 18:26:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667438780; cv=none; d=google.com; s=arc-20160816; b=N4mG/Wqo83CnSANrMG5GmwHC7eUlF8PwKY9c6FzaEVtlf8UMtFItdOmp2BZ48BDsxB fcpnKN7uLy8F3LEheOh8hn1wz04jBo5/E1DahDpu7QUwQeINBGekrAdsK4ljwRrpjSC+ CVKg2Sa2mgAd6zC0A9YU3ID0AKv+ab1eh9AscHdPfEkvtOyS/NUMJem/yKJo1+YUbbbP fnVHIYYx9Conf4DKVu6pDi/HBjjnm8P3RnttUY6GWSt9GDTzbLej13GIeOI0D5+tGfWW jUxcVb47Xlz+GJ1ELcu263lAbD4EYBQ9n+J8D9lHqqze0tbCUGweQK2ldK9mHe1mZbC5 neTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=cAqvb1adlE7m5v5c13p4uOoA9i8UZn25iiLsJE+izqc=; b=nTTgVK5/ECc/VpIhgbT2774WgmrLBuoGT4r/UNJymYfODBr3xkuM5Oic9v242fflMq hBA9mndCootLAyo/vFKYrPhsnSHpnUz+/gOcx8ixno2Fw8Lqg0+WQ3C5rN+fOiZnnjOf 9MaWVYW9mjQgTPWd3vw2xHeX/Gu9zkyODmdQXYM1PmIhH6Zoi7o0WaXLifRksV1oGtVn SXvueyUsrogShfy/i33Nxs0df1eo8hOlQZbu5urTkkSvwiM2wJFyj4WfIYnAx+tB2tBT OIWGvN29SKRBs1obYkcTntt3q7jtfXhYwjAeOT3cL08E94hQru3rgxqjnhG9wZVYrEjB B/DQ== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ho18-20020a1709070e9200b0078dcfe6a000si20390352ejc.727.2022.11.02.18.25.57; Wed, 02 Nov 2022 18:26:20 -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 S230491AbiKCBVL (ORCPT + 99 others); Wed, 2 Nov 2022 21:21:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229993AbiKCBVJ (ORCPT ); Wed, 2 Nov 2022 21:21:09 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B75E12A83; Wed, 2 Nov 2022 18:21:07 -0700 (PDT) Received: from kwepemi500012.china.huawei.com (unknown [172.30.72.56]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4N2mDF1KCbz15M1C; Thu, 3 Nov 2022 09:21:01 +0800 (CST) Received: from huawei.com (10.67.174.53) 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; Thu, 3 Nov 2022 09:21:04 +0800 From: Liao Chang To: , , , , , , CC: , , , Subject: [PATCH 2/2] KVM: x86: Fix a typo about the usage of kvcalloc() Date: Thu, 3 Nov 2022 09:17:49 +0800 Message-ID: <20221103011749.139262-1-liaochang1@huawei.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-Originating-IP: [10.67.174.53] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) 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,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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748436286994382138?= X-GMAIL-MSGID: =?utf-8?q?1748436286994382138?= 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;