Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp805273rwi; Wed, 2 Nov 2022 19:11:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM77BTvtzFRLJ5HDKvQHe0AUyYSI/D6DJwHnwcZTJzuImh88hi3OLNJM8ujuckYHWsbvP0VV X-Received: by 2002:a17:906:6a26:b0:7ad:975c:9785 with SMTP id qw38-20020a1709066a2600b007ad975c9785mr28757260ejc.25.1667441512267; Wed, 02 Nov 2022 19:11:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667441512; cv=none; d=google.com; s=arc-20160816; b=xuth17oyisLwdHOMCwy6zTA/Svk5o6UKl44AEFo5qd51Q9VDjLqTsg/MkQvtPniWkC biGMMlnOTxm1jJb4YBALlv6BoTD3r0OioqqV7bMf9naLl8GtaWzMSN3t+MHfb0D3EDIw f3BMNucaKtvf3j3MLIErUzRRQww2kdg1B140C/eSvCCNcc3z9YjMo5HrYuEq2f01RoUw aq6Tu9tuJdZHTHoLn0WcPhgyu3SrU/UQr9jFmAsmKa5rQp5pKZwEA6pQDG3ldm/bmtPa 4CPd7YkCFYQNIqEbG/KII28ctLRRrd1fjUKNCTUDnrfqEOJVgVatpu34HBU4TvlKek2P dExw== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hr7-20020a1709073f8700b00788166eaab6si17796418ejc.745.2022.11.02.19.11.29; Wed, 02 Nov 2022 19:11:52 -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 + 97 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 Content-Type: text/plain 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 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); -- 2.17.1