From patchwork Thu Apr 22 09:25:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "humin (Q)" X-Patchwork-Id: 92012 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 21646A09E4; Thu, 22 Apr 2021 11:25:00 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0022C413E6; Thu, 22 Apr 2021 11:24:59 +0200 (CEST) Received: from szxga06-in.huawei.com (szxga06-in.huawei.com [45.249.212.32]) by mails.dpdk.org (Postfix) with ESMTP id BB5EE4069D for ; Thu, 22 Apr 2021 11:24:57 +0200 (CEST) Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4FQsQp3SVpzjZyn for ; Thu, 22 Apr 2021 17:22:58 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.498.0; Thu, 22 Apr 2021 17:24:52 +0800 From: "Min Hu (Connor)" To: CC: , Date: Thu, 22 Apr 2021 17:25:05 +0800 Message-ID: <1619083505-65454-1-git-send-email-humin29@huawei.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-Originating-IP: [10.69.192.56] X-CFilter-Loop: Reflected Subject: [dpdk-dev] [PATCH] baseband/turbo_sw: fix dereference of null X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Return value of a function 'rte_malloc' is dereferenced without checking, and may result in segmetation fault. This patch fixed it. Fixes: 31a7853d1ed9 ("baseband/turbo_sw: support large size code block") Cc: stable@dpdk.org Signed-off-by: Min Hu (Connor) Acked-by: Nicolas Chautru --- app/test-bbdev/test_bbdev_perf.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/test-bbdev/test_bbdev_perf.c b/app/test-bbdev/test_bbdev_perf.c index 45b85b9..f94e2a9 100644 --- a/app/test-bbdev/test_bbdev_perf.c +++ b/app/test-bbdev/test_bbdev_perf.c @@ -957,6 +957,9 @@ init_op_data_objs(struct rte_bbdev_op_data *bufs, if ((op_type == DATA_INPUT) && large_input) { /* Allocate a fake overused mbuf */ data = rte_malloc(NULL, seg->length, 0); + TEST_ASSERT_NOT_NULL(data, + "rte malloc failed with %u bytes", + seg->length); memcpy(data, seg->addr, seg->length); m_head->buf_addr = data; m_head->buf_iova = rte_malloc_virt2iova(data);