From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id DCFB4A0C4B for ; Tue, 12 Oct 2021 10:33:26 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BD456410E8; Tue, 12 Oct 2021 10:33:26 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id A070F4003C; Tue, 12 Oct 2021 10:33:24 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 19C4UVSp023989; Tue, 12 Oct 2021 01:33:23 -0700 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-transfer-encoding : content-type; s=pfpt0220; bh=GHzuY+q3v8Tz+2QBx11AMdRV5TPgg1E/95WJ/VXOiTo=; b=PK/5/rH6yLRHX/hU5ALIiBy4sXASz68J3WvDz8rP0BJ0wn5AHLqaM4cRgriOSzk09DjX wD5ILGjm++G2fKlsU1Czwp5Re75LR0fOv4mUeNCWI5vrWMDR6TLHWRXWvKPhpvggAQQg nmHQZHX4eUP7O6FlHgQ/sZ3HT8nKkz+iYeMafRrZ3kgpXvwKx8r81SrKbd6lB5ZTyXI8 7DqEP5bmcjS/L3vutlY+RRF6KXQbfSVKo9p/iWgIk24oTj4haFt2vbPQU3fLYbS/abko brxLZQI6aRxr55gD11BWEUp3Ud+PpdOLzg0xzmockdqyeqFTNKEgBmDLfOxLrkfCwOeg BQ== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com with ESMTP id 3bn3d595n8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 12 Oct 2021 01:33:23 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Tue, 12 Oct 2021 01:33:22 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Tue, 12 Oct 2021 01:33:22 -0700 Received: from localhost.localdomain (unknown [10.28.34.25]) by maili.marvell.com (Postfix) with ESMTP id 706DA3F7041; Tue, 12 Oct 2021 01:33:20 -0700 (PDT) From: To: Xiaoyun Li CC: , Sunil Kumar Kori , Date: Tue, 12 Oct 2021 14:03:17 +0530 Message-ID: <20211012083317.399870-1-skori@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211012073624.399404-1-skori@marvell.com> References: <20211012073624.399404-1-skori@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-ORIG-GUID: BOMPZP949DnlgaFc6WcMTv6irzNM8k-n X-Proofpoint-GUID: BOMPZP949DnlgaFc6WcMTv6irzNM8k-n X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.0.607.475 definitions=2021-10-12_02,2021-10-11_01,2020-04-07_01 Subject: [dpdk-stable] [PATCH v2 1/1] app/testpmd: fix invalid memory access X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 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" From: Sunil Kumar Kori During parsing of DSCP entries, memory is allocated and assigned to *dscp_table. Later on, same memory is accessed using *dscp_table[i++]. Due to higher precedence for array subscript, dscp_table[i++] will be executed first which actually does not point to the same memory which was allocated previously for DSCP table entries. Cc: stable@dpdk.org Fixes: 459463ae6c26 ("app/testpmd: fix memory allocation for DSCP table") Signed-off-by: Sunil Kumar Kori --- v2: - Correct spelling mistakes - Correct fixes tag app/test-pmd/cmdline_mtr.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/test-pmd/cmdline_mtr.c b/app/test-pmd/cmdline_mtr.c index b5dcfdadcf..ad7ef6ad98 100644 --- a/app/test-pmd/cmdline_mtr.c +++ b/app/test-pmd/cmdline_mtr.c @@ -101,13 +101,13 @@ parse_dscp_table_entries(char *str, enum rte_color **dscp_table) while (1) { if (strcmp(token, "G") == 0 || strcmp(token, "g") == 0) - *dscp_table[i++] = RTE_COLOR_GREEN; + (*dscp_table)[i++] = RTE_COLOR_GREEN; else if (strcmp(token, "Y") == 0 || strcmp(token, "y") == 0) - *dscp_table[i++] = RTE_COLOR_YELLOW; + (*dscp_table)[i++] = RTE_COLOR_YELLOW; else if (strcmp(token, "R") == 0 || strcmp(token, "r") == 0) - *dscp_table[i++] = RTE_COLOR_RED; + (*dscp_table)[i++] = RTE_COLOR_RED; else { free(*dscp_table); return -1; -- 2.25.1