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 9DD2BA0524; Mon, 19 Apr 2021 19:48:58 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 692FA413DE; Mon, 19 Apr 2021 19:48:58 +0200 (CEST) Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam08on2042.outbound.protection.outlook.com [40.107.100.42]) by mails.dpdk.org (Postfix) with ESMTP id 634D8413B0 for ; Mon, 19 Apr 2021 19:48:56 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JvGqvJNzkbagLaer4QQpUOCAW6WOldYB/kopkryQJIyzYnVT8pwRYwp+YrQ4SWjfQIoAWfQT7de88AlQRADQN7Wbbb1DQYGoOLv24uJmw1Fz5VI7QfkRhDQwFZRRBtl/VPOIUEmffUZq4klovDsZQLG/vEnDQ+VLEtqHfCH1xvJWmcOxdowBCdJncYSw+XZCl5Xv8LqFT49JjfEoKfl9kFV8Nx2NELN6MmlXPZ7gjfUVP1XvUBo4OIF8rvmBhXUlJRmm83NcI8oYlEH7QbkC/swTafZNy9fcXXXUSVReEyZqqKcyY8EzA5P8ifSPKfvDjC0nWLuKm8QCRyh/p3hc4A== 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=fsfAy9S6Go1ZiRuJXvkhPZgKLsVimYIHksxWZgREcnQ=; b=bAL/Ng+U+sM27lbPXIEGN7Sq3XCH2wFjJpM55aOYQmKjVd7fmvalHN5TkrBcqJKWWj2SYtT4PkGwoNfNrOCz0sLcEz4kWbqs9Di+sjaBWfXXjCsf/YA4cAGEW8BfG6FtSA00jcjbl3bIswt6Zt9hVlbl51DTw8Sfb5y+aSuWvHoboHOFX0Yy4IlBvdTNCiMxViNxmYkKUQcY1SU8Gh5YCSG+TVa8haNNzyjeLwBJXYauFUDMZeG30Ni0wuAUXxsTq7rf5DYBUgI9r9UjqqOshFo77whhS+BDU1YBOnT/edcjqPOvdKYm6rA3ysLg9keCNhaoD9aIRYhdy01Q6b76YA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fsfAy9S6Go1ZiRuJXvkhPZgKLsVimYIHksxWZgREcnQ=; b=EIxy6U+wxTRREU+ZoOvXb/WDOP/RWSOVvzU+8uVcaXqi2AHZAKyDyLwZKcsz/vuDzX0Wg7hrwjz+7GruTE9MhtQ7UfSZaEvPyQkeCtHRGTtgSj3rowv/1wlJJZT5rHdCiATJKhPdnl2n+/pWPl4C8BmAUCEVMq90yLiMMQ3E+2ZfY4LkNRF8vzy6uYF32B4qZhKCtTTema5mGAamw9VuN7hbLvsBaEmxL+p5s1FvEV+cikS51ilxaT76v2hu1TcOsW7JQ1Tjc9W2wOEBD86V86NMmwMrYOKm1iUoXmGXe3ekPt3AOzLXMmHAhwmD3WrV1GEHWvtNxfd5rknaW+9gZg== Received: from DM6PR12MB4987.namprd12.prod.outlook.com (2603:10b6:5:163::31) by DM6PR12MB2892.namprd12.prod.outlook.com (2603:10b6:5:182::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4042.24; Mon, 19 Apr 2021 17:48:55 +0000 Received: from DM6PR12MB4987.namprd12.prod.outlook.com ([fe80::f5ce:c5a8:6aec:e308]) by DM6PR12MB4987.namprd12.prod.outlook.com ([fe80::f5ce:c5a8:6aec:e308%7]) with mapi id 15.20.4042.023; Mon, 19 Apr 2021 17:48:55 +0000 From: Ori Kam To: "Min Hu (Connor)" , "dev@dpdk.org" CC: "ferruh.yigit@intel.com" , "cristian.dumitrescu@intel.com" , "jerinj@marvell.com" , "jianjay.zhou@huawei.com" , "jia.guo@intel.com" , "g.singh@nxp.com" , "andrew.rybchenko@oktetlabs.ru" , "hemant.agrawal@nxp.com" Thread-Topic: [PATCH 04/10] app/regex: fix division by zero Thread-Index: AQHXNSDG3pHdRrpW5U6FjxhiLOlHaqq8HdLg Date: Mon, 19 Apr 2021 17:48:54 +0000 Message-ID: References: <1618839289-33224-1-git-send-email-humin29@huawei.com> <1618839289-33224-5-git-send-email-humin29@huawei.com> In-Reply-To: <1618839289-33224-5-git-send-email-humin29@huawei.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: huawei.com; dkim=none (message not signed) header.d=none;huawei.com; dmarc=none action=none header.from=nvidia.com; x-originating-ip: [147.236.145.126] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: ba53577c-6c66-4a2a-d032-08d9035b66c3 x-ms-traffictypediagnostic: DM6PR12MB2892: x-microsoft-antispam-prvs: x-ms-exchange-transport-forked: True x-ms-oob-tlc-oobclassifiers: OLM:8273; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: nBeMrTSn6VW9PxmmMzkrlxzzINJN+5rucsVZgDISA6HyYGD4R3qa95UvgdDOY75qfh0uXiAxqWKZ37gl4FZ7Dqkou4FxbaJClJ1PUasR3qRTIpYxQuQmsRUdOTNf6fH52dMMAhdc7ZKZOCVNuEpQj/r1NYCPRUb9FO0QzcaCkSKwXGQSkt7vfK5tjcKsF0bvsR2bTI2r8j7xBL8grmB2xTE3iVcP3zCGJP5i2bR12Jg4jZSUtNaS3RIIzVq0wYfL1LvpczZUJUg0ef3iDgj7ouSLsCcdlUdEkr4lTuk0CUX4GaIUNfxTPy55bHH1BNBwZMRQNnpe563hqvq64FTeUeDP3Qb4uDKanbm1b0/nEZR0Nv35lY2p3sQXeUVO/fRHsPZ2vaLlTxeteOtib3EJN+FTimA7E7Pvepffrdb9js57wZtjA4WImIjfJICR2PLulgpykEJBqKF7NjjcHJH6+CgS4ADu9N/UvAjZrZklchRYaAj5Idc45QYfFKf9bbJhA46BdASK6ZJ5GemAsF8HAMuscMDseGzx0GHl9zjAI/JVydJwl+fGmU7/C7RzDkMBq8PukqCdB1IkPqND+KTygRxsj0oescT/N0g8jY4028c= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR12MB4987.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39860400002)(396003)(376002)(136003)(366004)(346002)(83380400001)(4326008)(9686003)(55016002)(64756008)(8676002)(71200400001)(86362001)(7416002)(33656002)(76116006)(66446008)(122000001)(8936002)(66476007)(53546011)(6506007)(478600001)(52536014)(5660300002)(54906003)(110136005)(2906002)(26005)(316002)(66946007)(186003)(38100700002)(66556008)(7696005); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?vaFg50vtviNKR1GkVHLUQnnA554SMucCi4AeOUeoxvQEiu+j1Ai4LHE8dFCI?= =?us-ascii?Q?+8q3M5aScW0yX/aGVeKU7lOUB1GBkqT7tN6Fsv0+5JSaqZEWiT9a5r4U0Tp9?= =?us-ascii?Q?P3ErROVYRKfn6i8mmpsIGJ068ZkAgyceHYDNNVR/XzDtkPSjUGTzwk5reQ1u?= =?us-ascii?Q?yxtgqdtugr0mEdid905kJ862tYqpHHhdj6DsftWzhGnDV3OtLgSWZuCvZvDg?= =?us-ascii?Q?rGKNWqsTRgnoq++e8kfkYB23EVNrhjqkyNhUAZd3qLxPA2p3YnoypgESO5lJ?= =?us-ascii?Q?NHH0vELMj5Lb8krOM/jHr9z9hgHCoFX96uW016wAHA7yMd3tddF1z+f4XzI9?=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mdlkyh4t9oHf0o7ZYiq09MbYskPyYtzJ9?= =?us-ascii?Q?5Q3ISrOsBzr0g2eahmoj/enhLS6T66wl7+OTyZcDDBJU4aTZB2kq2uMxtdrr?= =?us-ascii?Q?9pa0Y1dB5PR4qS2Bz8RaAoza?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM6PR12MB4987.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: ba53577c-6c66-4a2a-d032-08d9035b66c3 X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Apr 2021 17:48:54.9372 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: t6Z1QF+58JLqdFKS0awN1z/M2u/bcyMAIGrQP1Jq00OdpyF2ZlFSs1ctMUwuCXLoXqVGm2XH/OySSYTWflcrEw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB2892 Subject: Re: [dpdk-dev] [PATCH 04/10] app/regex: fix division by zero 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" Hi Min, > -----Original Message----- > From: Min Hu (Connor) > Sent: Monday, April 19, 2021 4:35 PM > Subject: [PATCH 04/10] app/regex: fix division by zero >=20 > Variable nb_jobs, which may be zero, is used as a denominator. >=20 > This patch fixed it. >=20 > Fixes: f5cffb7eb7fb ("app/regex: read data file once at startup") > Cc: stable@dpdk.org >=20 > Signed-off-by: Min Hu (Connor) > --- > app/test-regex/main.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) >=20 > diff --git a/app/test-regex/main.c b/app/test-regex/main.c > index 8e665df..b49fa88 100644 > --- a/app/test-regex/main.c > +++ b/app/test-regex/main.c > @@ -725,9 +725,11 @@ main(int argc, char **argv) > if (data_len <=3D 0) > rte_exit(EXIT_FAILURE, "Error, can't read file, or file is > empty.\n"); >=20 > - job_len =3D data_len / nb_jobs; > - if (job_len =3D=3D 0) > - rte_exit(EXIT_FAILURE, "Error, To many jobs, for the given > input.\n"); > + if (!nb_jobs) { > + job_len =3D data_len / nb_jobs; > + if (job_len =3D=3D 0) > + rte_exit(EXIT_FAILURE, "Error, To many jobs, for the > given input.\n"); > + } >=20 > if (job_len > nb_max_payload) > rte_exit(EXIT_FAILURE, "Error, not enough jobs to cover > input.\n"); > -- > 2.7.4 Acked-by: Ori Kam Thanks, Ori