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 E406FA04B3 for ; Fri, 13 Dec 2019 11:27:45 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C77441F5; Fri, 13 Dec 2019 11:27:45 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id 728481F5 for ; Fri, 13 Dec 2019 11:27:43 +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 xBDAKgCx013803 for ; Fri, 13 Dec 2019 02:27:42 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : subject : date : message-id : mime-version : content-type : content-transfer-encoding; s=pfpt0818; bh=OYUpkfrLirWr8592MWgUUOUwtO9SM1eYUSdgjYhPY5g=; b=lWLa1vsv8lip8y41V3vkyhJjJLkCELJFYk8d+e9jlfBRwZanojQswzWm91ORpL7xGJt9 1+5Y9zYj8Co9dFqogH/FBiNe8PqOpRkS9R0KIQVoKUZyk8VQDKSJyvonUb3cSmurMRuU xMqvXKWqz+8UfqNGLTehUHaV2kxfKWC0tz/JpDqIlFCWQm5LOaYOhOD8d8UbmrYzS+4C VJwmhpLbfL/qh/VmV/2n/dHqtteRPlxN0Lk0cXqQ0ApF3FqPWnKFcrzL4zk95UJVHhBB hxS7WliRMSwphQQOY8NIriwZ6gvpWaJLOmsuASIA1WzVhKrsL49nFrwmjr7bg1GYFIrz dw== Received: from sc-exch02.marvell.com ([199.233.58.182]) by mx0a-0016f401.pphosted.com with ESMTP id 2wuegjdyfs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Fri, 13 Dec 2019 02:27:42 -0800 Received: from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 13 Dec 2019 02:27:38 -0800 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Fri, 13 Dec 2019 02:27:38 -0800 Received: from amok.marvell.com (unknown [10.95.130.185]) by maili.marvell.com (Postfix) with ESMTP id 8251B3F703F for ; Fri, 13 Dec 2019 02:27:37 -0800 (PST) From: Andrzej Ostruszka To: Date: Fri, 13 Dec 2019 11:27:36 +0100 Message-ID: <20191213102736.16867-1-aostruszka@marvell.com> X-Mailer: git-send-email 2.17.1 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-12-13_02:2019-12-13,2019-12-13 signatures=0 Subject: [dpdk-stable] [PATCH 18.11] net/dpaa2: fix possible use of uninitialized vars X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" [ upstream commit 7bbc7dc431a66e81514219f1734ed263a3db3359 ] 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") Cc: stable@dpdk.org Signed-off-by: Andrzej Ostruszka --- drivers/net/dpaa2/mc/dpkg.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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