patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
To: Ori Kam <orika@nvidia.com>, Ophir Munk <ophirmu@nvidia.com>,
	"dev@dpdk.org" <dev@dpdk.org>,
	Raslan Darawsheh <rasland@nvidia.com>
Cc: "stable@dpdk.org" <stable@dpdk.org>,
	"\"'Lukasz Wojciechowski'\"," <l.wojciechow@partner.samsung.com>
Subject: Re: [dpdk-stable] [dpdk-dev] [PATCH v1] app/regex: fix segfault in getopt_long call
Date: Mon, 19 Oct 2020 10:13:02 +0200	[thread overview]
Message-ID: <ae33c2bc-3d69-0d66-2a92-ea7a766926d5@partner.samsung.com> (raw)
In-Reply-To: <MN2PR12MB4286E5BA82970DE7BF1F80B4D61E0@MN2PR12MB4286.namprd12.prod.outlook.com>

Hi,

W dniu 19.10.2020 o 09:46, Ori Kam pisze:
> Hi Ophir,
>
>> -----Original Message-----
>> From: Ophir Munk <ophirmu@nvidia.com>
>> Sent: Sunday, October 18, 2020 5:22 PM
>> Subject: [PATCH v1] app/regex: fix segfault in getopt_long call
>>
>> 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:
>>
>> struct option longopts[] = {
>> { "help",  0, 0, ARG_HELP},
>> ....
>> /* End of options */
>> { 0, 0, 0, 0 }
>> };
>>
>> This commit adds the last element. Prior to this commit getopt_long()
>> continued parsing beyond the longopts[] array which occasionally caused
>> segmentation faults.
>>
>> Fixes: de06137cb295 ("app/regex: add RegEx test application")
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: Ophir Munk <ophirmu@nvidia.com>
>> ---
>>   app/test-regex/main.c | 4 +++-
>>   1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> 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, char
>> *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 }
>>   	};
>>
>>   	argvopt = argv;
>> --
>> 2.8.4
> Acked-by: Ori Kam <orika@nvidia.com>
Acked-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
> Thanks,
> Ori

Best regards

Lukasz

-- 
Lukasz Wojciechowski
Principal Software Engineer

Samsung R&D Institute Poland
Samsung Electronics
Office +48 22 377 88 25
l.wojciechow@partner.samsung.com


  reply	other threads:[~2020-10-19  8:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-18 14:21 [dpdk-stable] " Ophir Munk
2020-10-19  7:46 ` Ori Kam
2020-10-19  8:13   ` Lukasz Wojciechowski [this message]
2020-10-19  8:39     ` [dpdk-stable] [dpdk-dev] " Ophir Munk
2020-10-19 22:05       ` Thomas Monjalon
2020-10-19 22:06     ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ae33c2bc-3d69-0d66-2a92-ea7a766926d5@partner.samsung.com \
    --to=l.wojciechow@partner.samsung.com \
    --cc=dev@dpdk.org \
    --cc=ophirmu@nvidia.com \
    --cc=orika@nvidia.com \
    --cc=rasland@nvidia.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).