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 99CABA04DC; Mon, 19 Oct 2020 09:46:44 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D17B7BCC6; Mon, 19 Oct 2020 09:46:41 +0200 (CEST) Received: from hqnvemgate26.nvidia.com (hqnvemgate26.nvidia.com [216.228.121.65]) by dpdk.org (Postfix) with ESMTP id 694E6AD75; Mon, 19 Oct 2020 09:46:39 +0200 (CEST) Received: from hqmail.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate26.nvidia.com (using TLS: TLSv1.2, AES256-SHA) id ; Mon, 19 Oct 2020 00:46:25 -0700 Received: from HQMAIL101.nvidia.com (172.20.187.10) by HQMAIL105.nvidia.com (172.20.187.12) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Mon, 19 Oct 2020 07:46:36 +0000 Received: from NAM04-SN1-obe.outbound.protection.outlook.com (104.47.44.58) by HQMAIL101.nvidia.com (172.20.187.10) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Mon, 19 Oct 2020 07:46:36 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BFdpGl8iVcnoWPOBZDQxLXxOlZC1SV6nD3VFbjh7nuI8rikmfJ/hyiZsvY7OHk9DXyReXPhI47pvcRI0+jFy+6YS9top0kuQwoLF1Q4XGeh/qlZCmca4rsqMhPnJkyVTmNLUy2S80/0cjSliT2zeNdcpSRGx/OvEbKjUhS9DTCJsyJqOWZD8n5H3iGR3aaGPIsr/L0UJ84wfkjcmbRDzwEFAcAkCsSVRlaIgFywRLOom5jDwSVpTfyrEzJXnJuVrwLv9ZQ/gl4qAFxvXxO22jgX+jiRpk9ZyrWLeCYXykshdif/acmNkS3vshmVMuqHnE++f2JfGOhVG+coha5yQjw== 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=r4tMbegk5sFrRUWGoMMN+N2IlYQmDrejLkg4vONt3Cw=; b=RgyYk14+gzIjbTEQh4kz6cgc+FOOxIsGqrN2wl3mtyM8UBYDsBadStskCic20bzqYIDyiHXYk1Jo9VIc7xpetFh752HsTuI4rkpueQVqhjy9v8cgKN9jF9GewMo6wz1CdxzfwTGBdAyWlQnkaJNbZpxySM+A0St+clYMnnvY4hIH/Q9Fxa8o/P+N5q4mKRQ5A6zrDcJ93jVGJwL6JGcsXfIbSZQeZDzW/t+hePnDnveNzF2yEylWvvDGnM0CcTmN5QUdOaFclrjg+vPQc1+t6kUIUAtOIGcGZ1n70vh3ToianALCab6tW1wCHQJJ2kWz2/Cab26WPA9aLISU3DqCSg== 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 Received: from MN2PR12MB4286.namprd12.prod.outlook.com (2603:10b6:208:199::22) by MN2PR12MB4517.namprd12.prod.outlook.com (2603:10b6:208:267::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.25; Mon, 19 Oct 2020 07:46:35 +0000 Received: from MN2PR12MB4286.namprd12.prod.outlook.com ([fe80::28b4:b63a:c74c:be99]) by MN2PR12MB4286.namprd12.prod.outlook.com ([fe80::28b4:b63a:c74c:be99%5]) with mapi id 15.20.3477.028; Mon, 19 Oct 2020 07:46:35 +0000 From: Ori Kam To: Ophir Munk , "dev@dpdk.org" , "Raslan Darawsheh" CC: Ophir Munk , "stable@dpdk.org" Thread-Topic: [PATCH v1] app/regex: fix segfault in getopt_long call Thread-Index: AQHWpVoL8MIUke7z20CBp+mbNeblCKmejRZw Date: Mon, 19 Oct 2020 07:46:35 +0000 Message-ID: References: <20201018142147.11456-1-ophirmu@nvidia.com> In-Reply-To: <20201018142147.11456-1-ophirmu@nvidia.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: nvidia.com; dkim=none (message not signed) header.d=none;nvidia.com; dmarc=none action=none header.from=nvidia.com; x-originating-ip: [147.236.152.129] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: f9e948cf-b3b2-430f-dea3-08d874031ae7 x-ms-traffictypediagnostic: MN2PR12MB4517: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:279; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: may+qqy5O5krSnCuTecimwasElgyrlkV9nvbuH8EmhegOOhjcvvrIoTxyiGShEslt1A3AFTT9TXuAVFCyhX6c870Hib3qd2DKGeNn9NI3wddC969MQjjPbqMfVJAzHNtXlRt06Vb8V+V2V9hpI5YTRnwUrN/xZH3xMki1Zl5HZSX/GTMjhOWZUf3ev5gzSD7Ss0gA6e7HszqpPHzwhJm7Ff1Wk9ivnXJ+pgyrEmWEs95vI+FrfJTy2JCGVopNkoW2zxDMWq/1aLZu0zoP8iSlwERJO1jihnjF0FbPtV7J3Wbh8nlNRg9IJC2kXScojF//5EQPIvX6IbPHBwiOZhhmQ== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MN2PR12MB4286.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(346002)(396003)(136003)(39860400002)(376002)(76116006)(2906002)(52536014)(6636002)(53546011)(64756008)(66446008)(66946007)(66476007)(66556008)(71200400001)(54906003)(8676002)(316002)(110136005)(8936002)(186003)(478600001)(7696005)(55016002)(6506007)(26005)(5660300002)(4326008)(83380400001)(9686003)(33656002)(86362001)(450100002); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: lSUca7miC5Tua3qCICxTU76vuuym/1pV4xIclC7gJQlZ8B50o+gBSHu9WKHLMqF8e1i9iaJ62Kr32UUUqTRG/ftuVsxQiWowTsxxS4oodFIAQu9t/K9zv4PMAu/X/zYzB86VmDFV9JiNZ+PtvzZttt3hZ7IEh6jp6sdX7zwLCIvSmynF/ZK7T+mviw5RW03mJdUg0ppRIGz1WOaeA7q/MpAep5/K+uBxZTDPIFuuTfHNzpkM2OWWlXLfZOug9aOQQPsNneIzkbYE+dWyqVJCI2h9n7E3FE35FntDQ1FLZryr07Vak9SaaTJBSNmR5YXX5Sjvk4BYJ1FIYiVlLHQYTVzy43EM4Kk623CPCPNL9ld3JnOjlT3EzRX047mOuikKhegrSZgzLc8o3cNqRKdoGtZ7TT3CilZTejKv4g/p0fKxH3LotXAMH5IqSpLJFnxTqxodQCMXtxzC3Zga1RN3ChcqIt+UikvraVpAt2QiffcmIwZUjDZdVSREryyLqEtzQ7Rt+EPcCbmQ201Ks476+VWBj50K84oba+mnOj3ItiuHtFmVLAw7kuwe/CVgQTPyiVzBc/KaLtMQiF+cH8LaAH3qD3fW01Bv314BincyZCuM2griDtfJhqv7Ok0CKInInIXm4HOp3pW7XSlRg2aJIw== Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MN2PR12MB4286.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: f9e948cf-b3b2-430f-dea3-08d874031ae7 X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Oct 2020 07:46:35.6190 (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: 3WxlBUIT7ropxRyXcqJ5giZ+M1yvFTIkt5rLzam8VRGtMM/F25i4ojsakgxDiiIJgFkoLbVE+JLMhuebunyZRw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4517 X-OriginatorOrg: Nvidia.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1603093585; bh=r4tMbegk5sFrRUWGoMMN+N2IlYQmDrejLkg4vONt3Cw=; h=ARC-Seal:ARC-Message-Signature:ARC-Authentication-Results:From:To: CC:Subject:Thread-Topic:Thread-Index:Date:Message-ID:References: In-Reply-To:Accept-Language:Content-Language:X-MS-Has-Attach: X-MS-TNEF-Correlator:authentication-results:x-originating-ip: x-ms-publictraffictype:x-ms-office365-filtering-correlation-id: x-ms-traffictypediagnostic:x-ms-exchange-transport-forked: x-microsoft-antispam-prvs:x-ms-oob-tlc-oobclassifiers: x-ms-exchange-senderadcheck:x-microsoft-antispam: x-microsoft-antispam-message-info:x-forefront-antispam-report: x-ms-exchange-antispam-messagedata:Content-Type: Content-Transfer-Encoding:MIME-Version: X-MS-Exchange-CrossTenant-AuthAs: X-MS-Exchange-CrossTenant-AuthSource: X-MS-Exchange-CrossTenant-Network-Message-Id: X-MS-Exchange-CrossTenant-originalarrivaltime: X-MS-Exchange-CrossTenant-fromentityheader: X-MS-Exchange-CrossTenant-id:X-MS-Exchange-CrossTenant-mailboxtype: X-MS-Exchange-CrossTenant-userprincipalname: X-MS-Exchange-Transport-CrossTenantHeadersStamped:X-OriginatorOrg; b=qDls5dfPemXdwDxWmBEUSEhfHbcD7M3JbxbBj+/nYDTUH55pXqmPif4dP9npM1I0/ 9iM87RPnVyNOfiltuP/cOpxob2x4JUM9YIlnNJxz4hjmCirq8TGxmuw4i3At78FYmk kIAJX3eOqb7R0dKSazWTpY3y5SLOq4qaX7/NV3bA4npT+RXDz7IvnST6FEY3i4T5f3 YMsHVjzvPeP+TmZXFEarWHdN5FM8YryZ5lVEEQTvqedsAjzFLczVeeuA/vhUMJf0lb a2GcO8p6MH71533cIv0lsvkkifDJJtycy6YPearSRs2Hcb6Y4fwv3mRcabvyglVwkF pp29YtLqKyiHw== Subject: Re: [dpdk-dev] [PATCH v1] app/regex: fix segfault in getopt_long call 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" Hi Ophir, > -----Original Message----- > From: Ophir Munk > Sent: Sunday, October 18, 2020 5:22 PM > Subject: [PATCH v1] app/regex: fix segfault in getopt_long call >=20 > getopt_long() parses command-line arguments. One of its arguments > 'longopts' is a pointer to the first element of an array of struct > option. The last element of the array has to be filled with zeros > to mark the end of options. For example: >=20 > struct option longopts[] =3D { > { "help", 0, 0, ARG_HELP}, > .... > /* End of options */ > { 0, 0, 0, 0 } > }; >=20 > This commit adds the last element. Prior to this commit getopt_long() > continued parsing beyond the longopts[] array which occasionally caused > segmentation faults. >=20 > Fixes: de06137cb295 ("app/regex: add RegEx test application") > Cc: stable@dpdk.org >=20 > Signed-off-by: Ophir Munk > --- > app/test-regex/main.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) >=20 > diff --git a/app/test-regex/main.c b/app/test-regex/main.c > index 0d35f45..e6080b4 100644 > --- a/app/test-regex/main.c > +++ b/app/test-regex/main.c > @@ -66,7 +66,9 @@ args_parse(int argc, char **argv, char *rules_file, cha= r > *data_file, > /* Perf test only */ > { "perf", 0, 0, ARG_PERF_MODE}, > /* Number of iterations to run with perf test */ > - { "nb_iter", 1, 0, ARG_NUM_OF_ITERATIONS} > + { "nb_iter", 1, 0, ARG_NUM_OF_ITERATIONS}, > + /* End of options */ > + { 0, 0, 0, 0 } > }; >=20 > argvopt =3D argv; > -- > 2.8.4 Acked-by: Ori Kam Thanks, Ori