From patchwork Thu Nov 12 17:43:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavan Nikhilesh Bhagavatula X-Patchwork-Id: 84076 X-Patchwork-Delegate: jerinj@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 12035A09DE; Thu, 12 Nov 2020 18:43:50 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A5DF65928; Thu, 12 Nov 2020 18:43:47 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 232AC4CA6; Thu, 12 Nov 2020 18:43:45 +0100 (CET) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0ACHfDQ8007876; Thu, 12 Nov 2020 09:43:44 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=TexUJIOeZe/8ZWB9/4D1+88NZqoaK5kcFWuKpg9q75Y=; b=jxV1gZHF20B+oIhJIjKEYTAfj8PsCBmxsghB76LKkNAdUL8eAh0A0Tylf0gf2+hM0xvv /mran0pSHHpksyI3nA+6/IqRiIaUS6yKkx7M2KBwW7CWb8ETxP/M2n8p8gBuMuTiLDBG lr7iqi+TL3hAoLEuXgQbpvs3faLxKOQOOHhGI3DitHTPPXxT745ixP3VbFajTUdwlHF0 I70sxFOPWrM6cVSEivMOUqbDCGfk/7NG4vxkbZe3mHYMISR41C/+SZ2eYexrJnJ/y5uO K59VUb4jzcRTkMtVBi11lKqV1JzQ2IJLWZkR81m6JpRU6Fs4fQY+LfgmDyldcxFhZKmh uA== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0b-0016f401.pphosted.com with ESMTP id 34nuysv53y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 12 Nov 2020 09:43:44 -0800 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 12 Nov 2020 09:43:42 -0800 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 12 Nov 2020 09:43:41 -0800 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.2 via Frontend Transport; Thu, 12 Nov 2020 09:43:41 -0800 Received: from BG-LT7430.marvell.com (BG-LT7430.marvell.com [10.28.170.178]) by maili.marvell.com (Postfix) with ESMTP id 81E383F703F; Thu, 12 Nov 2020 09:43:39 -0800 (PST) From: To: CC: , Pavan Nikhilesh , Date: Thu, 12 Nov 2020 23:13:29 +0530 Message-ID: <20201112174330.313-1-pbhagavatula@marvell.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.312, 18.0.737 definitions=2020-11-12_08:2020-11-12, 2020-11-12 signatures=0 Subject: [dpdk-dev] [PATCH] app/eventdev: fix segfault with incorrect timer adadpters 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" From: Pavan Nikhilesh Fix SEGFAULT when nb_timer_adapters command line parameter is set to 0. Fixes: 98c6292105d4 ("app/eventdev: add options for event timer adapter") Cc: stable@dpdk.org Signed-off-by: Pavan Nikhilesh Acked-by: Jerin Jacob --- app/test-eventdev/evt_options.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/test-eventdev/evt_options.c b/app/test-eventdev/evt_options.c index 6994ac453..6aeab8257 100644 --- a/app/test-eventdev/evt_options.c +++ b/app/test-eventdev/evt_options.c @@ -197,6 +197,10 @@ evt_parse_nb_timer_adptrs(struct evt_options *opt, const char *arg) int ret; ret = parser_read_uint8(&(opt->nb_timer_adptrs), arg); + if (opt->nb_timer_adptrs <= 0) { + evt_err("Number of timer adapters cant be <= 0"); + return -EINVAL; + } return ret; }