From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9384FA034E; Thu, 7 Nov 2019 16:04:35 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E4A751BF86; Thu, 7 Nov 2019 16:03:42 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id 649781BF82 for ; Thu, 7 Nov 2019 16:03:41 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xA7Et5ul023864; Thu, 7 Nov 2019 07:03:40 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=pfpt0818; bh=G57MditZ3bILW6FE6qNqHB55xaQtT1qkRrqAG+rAFhA=; b=JU6rSnnjMuteVq3YPC6W0cR1vxYChZ9m2SY+W6RD3yXfDQ9Dv4ztsHdU/k39QLFZGpl2 i4bbb9rsf6a59fEeGl7VKHbZH/iasejOyfOfd/+b7WXVYXOR8j600K6rqjQx/dXNf0xV E6ZbwhTndAmzRvmTL+Mr3gk5V3xuVbOdk38R5T+9ZKSMUWJMFfbpbqwJH8F7rXJ7PJxB 4QNPAAPBNqXTfKm3wvBw6/pgkecwAQdR9JjoREpsdqd2w1QXFQEun3E4WAothot2X1rk 3AdfwaQFs5vIgkVeAjko9HsTTMENqPnDDg1l7gKWRxy8mqPFKIpU4BWLxjfGCrSh8Zzh zw== Received: from sc-exch02.marvell.com ([199.233.58.182]) by mx0a-0016f401.pphosted.com with ESMTP id 2w41uwvrfs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 07 Nov 2019 07:03:40 -0800 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 7 Nov 2019 07:03:39 -0800 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Thu, 7 Nov 2019 07:03:39 -0800 Received: from amok.marvell.com (unknown [10.95.130.48]) by maili.marvell.com (Postfix) with ESMTP id 2DA2C3F7040; Thu, 7 Nov 2019 07:03:37 -0800 (PST) From: Andrzej Ostruszka To: , Hemant Agrawal , Sachin Saxena CC: , Date: Thu, 7 Nov 2019 16:03:14 +0100 Message-ID: <20191107150318.3677-9-aostruszka@marvell.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191107150318.3677-1-aostruszka@marvell.com> References: <20191029141212.4907-1-aostruszka@marvell.com> <20191107150318.3677-1-aostruszka@marvell.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-11-07_05:2019-11-07,2019-11-07 signatures=0 Subject: [dpdk-dev] [PATCH v7 08/12] net/dpaa2: fix possible use of uninitialized vars X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" This patch fixes 'maybe-uninitialized' warnings reported by compiler when using LTO. Compiler warning pointing to this error (with LTO enabled): error: ‘kg_cfg.extracts[0].masks[0].mask’ may be used uninitialized in this function [-Werror=maybe-uninitialized] extr->masks[j].mask = cfg->extracts[i].masks[j].mask; Fixes: 16bbc98a3e63 ("bus/fslmc: update MC to 10.3.x") Signed-off-by: Andrzej Ostruszka --- drivers/net/dpaa2/base/dpaa2_hw_dpni.c | 1 + drivers/net/dpaa2/mc/dpkg.c | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/dpaa2/base/dpaa2_hw_dpni.c b/drivers/net/dpaa2/base/dpaa2_hw_dpni.c index 16555d7b0..47a8bda6a 100644 --- a/drivers/net/dpaa2/base/dpaa2_hw_dpni.c +++ b/drivers/net/dpaa2/base/dpaa2_hw_dpni.c @@ -51,6 +51,7 @@ rte_pmd_dpaa2_set_custom_hash(uint16_t port_id, kg_cfg.extracts[0].type = DPKG_EXTRACT_FROM_DATA; kg_cfg.extracts[0].extract.from_data.offset = offset; kg_cfg.extracts[0].extract.from_data.size = size; + kg_cfg.extracts[0].num_of_byte_masks = 0; kg_cfg.num_extracts = 1; ret = dpkg_prepare_key_cfg(&kg_cfg, p_params); diff --git a/drivers/net/dpaa2/mc/dpkg.c b/drivers/net/dpaa2/mc/dpkg.c index 80f94f40e..1e171eedc 100644 --- a/drivers/net/dpaa2/mc/dpkg.c +++ b/drivers/net/dpaa2/mc/dpkg.c @@ -63,7 +63,10 @@ dpkg_prepare_key_cfg(const struct dpkg_profile_cfg *cfg, uint8_t *key_cfg_buf) dpkg_set_field(extr->extract_type, EXTRACT_TYPE, cfg->extracts[i].type); - for (j = 0; j < DPKG_NUM_OF_MASKS; j++) { + if (extr->num_of_byte_masks > DPKG_NUM_OF_MASKS) + return -EINVAL; + + for (j = 0; j < extr->num_of_byte_masks; j++) { extr->masks[j].mask = cfg->extracts[i].masks[j].mask; extr->masks[j].offset = cfg->extracts[i].masks[j].offset; -- 2.17.1