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 A4D07A0555; Wed, 19 Feb 2020 14:30:53 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id BD6761B951; Wed, 19 Feb 2020 14:30:52 +0100 (CET) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 8A07D58C4 for ; Wed, 19 Feb 2020 14:30:50 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Feb 2020 05:30:49 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,459,1574150400"; d="scan'208";a="254096450" Received: from orsmsx107.amr.corp.intel.com ([10.22.240.5]) by orsmga002.jf.intel.com with ESMTP; 19 Feb 2020 05:30:49 -0800 Received: from orsmsx112.amr.corp.intel.com (10.22.240.13) by ORSMSX107.amr.corp.intel.com (10.22.240.5) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 19 Feb 2020 05:30:49 -0800 Received: from ORSEDG002.ED.cps.intel.com (10.7.248.5) by ORSMSX112.amr.corp.intel.com (10.22.240.13) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 19 Feb 2020 05:30:48 -0800 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.102) by edgegateway.intel.com (134.134.137.101) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 19 Feb 2020 05:30:49 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LbvsP8opTtFXZjhskJngpxiiXIyl6Aa+O1dVy4gh/H15jj79wmXbhu/e5GiNw861SaNVskh/rmvlrvfndWehL0ARdpPe6SRuwc7IIKvfkVnR6XLKWCm8y8C2oSl8myzzmTS8byOetJ0FPm5vC5uMqIcv+exabODmBayqC6b4IdfCvjPlnJ4qms9h0H3W5O43JMETpum/PbpZazKJr3Xi17fdq1T4tBjdif7H3ezODuzhTsv6GeXZHsAm2yLuUBiIGQN+wbvxJTtky59rr8bZaTyP0mA6nSVN2rEC4YcUZXijqC+uS6z+ZYDj6kHXbzqMsJqN8J8DuPJUBnBDz9oWMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=pIJHgOkvQwpPyLbwSKomciBU9gCG3exODlyQVLDPVJQ=; b=FGiKPGLaNTGtkvI+QaVrVpPNOherU+hxwkqcQWDhVMfsSokHAnkV9SzwfDFNbspxT9EuDzudUaYW4J8WIVJwePX3penxhyjHK0LakqtHslB/jHOe6CkbIyMht3VmXibC2/V6Q6Dmt79wSBoKpUgysXwo1d+0EHTjsyEc2evSnanyVvQYjLBsG+SDvPGR5na/SF78RkD67xLcihMlNTxuchB1zhlEmqKpPXzCBKy9loU0X/F9t5y3UAQo5uy4XbhYka/9/1NWN0KL9qDqVIG2SgP16POLGj+KRx0HFpCB7k7qWLrREtxqKkyXJhLhXqiOT7MR7xYVQCzOtZ8CdFH1jQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=pIJHgOkvQwpPyLbwSKomciBU9gCG3exODlyQVLDPVJQ=; b=zxQzMoUorKqw3kne5K48Jv2Pry4tnS9iqmpG1QFn+7Bky4X0yxA8cy0F3CvUpSCiqIcNvZhj4HKG9F2f0zwiAqXMRiKZjjLLNiRFFxEEyVlgbVmavSwrEgv/bQkqAqnkj50eA3jpG/J/lIQ60i5wFdLpiPWhG7f0eZDvfNEWut4= Received: from BYAPR11MB2952.namprd11.prod.outlook.com (20.177.224.11) by BYAPR11MB3223.namprd11.prod.outlook.com (20.177.186.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2729.22; Wed, 19 Feb 2020 13:30:47 +0000 Received: from BYAPR11MB2952.namprd11.prod.outlook.com ([fe80::9027:1aca:17a:e115]) by BYAPR11MB2952.namprd11.prod.outlook.com ([fe80::9027:1aca:17a:e115%6]) with mapi id 15.20.2729.032; Wed, 19 Feb 2020 13:30:47 +0000 From: "Lipiec, Herakliusz" To: "Yigit, Ferruh" , "Lu, Wenzhuo" , "Wu, Jingjing" , "Iremonger, Bernard" , "Govindharajan, Hariprasad" , "Burakov, Anatoly" CC: "dev@dpdk.org" Thread-Topic: [PATCH] app/testpmd: guarantee that array access is in range Thread-Index: AQHV5yHQEoevOl74SUSPss3/AjwCrqgigrhw Date: Wed, 19 Feb 2020 13:30:47 +0000 Message-ID: References: <20200219124003.1025267-1-ferruh.yigit@intel.com> In-Reply-To: <20200219124003.1025267-1-ferruh.yigit@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiODIyYjg5MTYtMzM3NC00YTVjLThjM2ItYjMyMWE0NzAwNmQ1IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiQndDR1FHcEpzeDhEYUxGZDJFRG1jT2lCRTJqVGF5XC9iR21wOHB5VkdQS1N6ZlhhdlhVTTFPM0QyTnlKY0JNaSsifQ== dlp-reaction: no-action dlp-version: 11.2.0.6 dlp-product: dlpe-windows x-ctpclassification: CTP_NT authentication-results: spf=none (sender IP is ) smtp.mailfrom=herakliusz.lipiec@intel.com; x-originating-ip: [192.198.151.190] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 62724343-b7ee-4326-4a76-08d7b53fedf1 x-ms-traffictypediagnostic: BYAPR11MB3223: x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6790; x-forefront-prvs: 0318501FAE x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(136003)(376002)(346002)(366004)(396003)(39860400002)(199004)(189003)(8676002)(33656002)(316002)(8936002)(110136005)(81166006)(4326008)(26005)(52536014)(66446008)(6506007)(64756008)(53546011)(5660300002)(66556008)(76116006)(66946007)(186003)(81156014)(66476007)(71200400001)(55016002)(9686003)(6636002)(7696005)(478600001)(2906002)(86362001)(921003)(1121003); DIR:OUT; SFP:1102; SCL:1; SRVR:BYAPR11MB3223; H:BYAPR11MB2952.namprd11.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: hmX4eIyeWTHS3ZcBQ7edgJJBp+P3eyPULP0Ege86fGC3c3UMBolLq/rqiwjG1X5gemW6s7qwQkdcWiPTNBZJVnR0jgQFK2xiHmB/hp+5hWwg7HDWw66WEoUJG6IXRBR/3bVoQfPdiNkDS405xG3XHUTVhmAKRt+6LLmxSLT0DctZcmvxnVMuEO/2B92V84q44RjiOHBXIygeP06AMx35im7BiKtgC63IoentQrJIqtk0NHFZXbY6jsIu/E7W3YiCKIh9f8mTzgaSJOBhB1eyB5ACpvmuvAJxOlWc2dL/GMwnxqYm1ROERWeLx9z4AoV01PcOj+qopQ+SQ6xG5CuTDJ1sakfZIYcL5eBA//kMEj7si7sPAiyNMXokBbLwhqeZZSz81jqBZ1wxQkaQ/Y3JX9t1QD1A/54EcrsEDSI3faYaXvemAqPGsgPjFKv6yOWHxujAAQ62X1SXllG5C7VtTSiUECPv5bpMNbHmmfKHqa49LCH9REylkz5H73CVBW2l x-ms-exchange-antispam-messagedata: yBNVuPOsMHM7h2ERT+ZkNwqA4Nj5S12awQN1vPFRqMrmSsRsHq/2zfM5Fy1wRh7h1ijdUapHYIqrpYaS1z/jfkeb3kmC0os8XsWCjH3mWmLvvd9VJCtSrbTiGKiuoFU9B0TmnX3Ry4RYl89h55tj/w== Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 62724343-b7ee-4326-4a76-08d7b53fedf1 X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Feb 2020 13:30:47.3916 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: uI3x7vvSXj892O4a0RU9p1L8OlKzj8PdWw17+TNjNkJh9GYLL+OAn/oJdoLlzL1exVNc9b+TfzMMdB7n+A3Dkqmsg3+Hjbjc4WFIry8VKK8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB3223 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH] app/testpmd: guarantee that array access is in range 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" > -----Original Message----- > From: Yigit, Ferruh > Sent: Wednesday, February 19, 2020 12:40 PM > To: Lu, Wenzhuo ; Wu, Jingjing > ; Iremonger, Bernard > ; Lipiec, Herakliusz > ; Govindharajan, Hariprasad > ; Burakov, Anatoly > > Cc: dev@dpdk.org; Yigit, Ferruh > Subject: [PATCH] app/testpmd: guarantee that array access is in range >=20 > Coverity complains about out of bound access, which is a false positive. >=20 > The return value of the 'parse_port_list()' can't be bigger than 'maxsize= ' > because of the logic in the function. ('value >=3D (int)maxsize' > check and 'marked[]' usage.) >=20 > But this is not explicitly clear, causing coverity warning and same quest= ion can > be rise by reviews later. >=20 > Adding a redundant check to highlight the access is in range, this is don= e by > replacing existing redundant check. >=20 > This is also good to protect against out out bound access in case > 'parse_port_list()' behaviour changes later unexpectedly. >=20 > Coverity issue: 354229 > Fixes: 2df00d562d20 ("app/testpmd: add --portlist option") >=20 > Signed-off-by: Ferruh Yigit > --- > app/test-pmd/config.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index > 9d9520223..d93941f03 100644 > --- a/app/test-pmd/config.c > +++ b/app/test-pmd/config.c > @@ -2703,7 +2703,7 @@ parse_fwd_portlist(const char *portlist) > * and thereby calculate the total number of > * valid ports > */ > - for (i =3D 0; i < portcount && valid_port_count < portcount; i++) { > + for (i =3D 0; i < portcount && i < RTE_DIM(portindex); i++) { > if (rte_eth_dev_is_valid_port(portindex[i])) { > portindex[valid_port_count] =3D portindex[i]; > valid_port_count++; > -- > 2.24.1 Reviewed-by: Herakliusz Lipiec