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 6B066A0487 for ; Fri, 5 Jul 2019 12:05:20 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 55B9C1BE1C; Fri, 5 Jul 2019 12:05:20 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id D2EE51BE19; Fri, 5 Jul 2019 12:05:18 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x65A3hiL002935; Fri, 5 Jul 2019 03:05:18 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pfpt0818; bh=LMMpsh3c4lrQNVp3H0cb6dJ0UnhCb6y21YSVf+KIEXI=; b=Yo4WAX7WXDgtObNxemG0iA7mgAKwaDv/f5LiYgkB4zVvWOgw8NLzVbHbd9dztXXWpxdO ZFPfUW2GT+n7pTfBYTO+KiMrw5ZirdiROk3QB6KEqgfCnakXq1sko3OczomZv9m72ZR+ w1Uc9ltipWSCiEunIeWruF3rlIwsW+1JAYoO7QGvVloYLQ2wuYsQ5kNiiwlrdDxub3Ve sccSivV7D9zIidT3GTF3MoPl3tp3Os7F2R6did9y9lfl7bmdqjZh5NDMW+xs6+7Osvpf XcJShvdpziqAVcAhjEyqiXj2z60E9FC2QyMrBZoVbiq+DfL+PEA2irN3J/ev26cRDVSf ag== Received: from sc-exch02.marvell.com ([199.233.58.182]) by mx0a-0016f401.pphosted.com with ESMTP id 2thv9p1nux-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Fri, 05 Jul 2019 03:05:17 -0700 Received: from SC-EXCH04.marvell.com (10.93.176.84) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Fri, 5 Jul 2019 03:05:16 -0700 Received: from NAM05-DM3-obe.outbound.protection.outlook.com (104.47.49.57) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Fri, 5 Jul 2019 03:05:16 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector2-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=LMMpsh3c4lrQNVp3H0cb6dJ0UnhCb6y21YSVf+KIEXI=; b=QFAfRnA1t+zXI9dVGurDPsGjRuKE6tyRkZ9vO/GAjV/57d9PVdoDFezhDZWvSVHwejNX1/ZF9SaOG59SLSP8O5O4vEFaJxVDsdWn2APKpOHFn35EjHWo5kBuGQmh5227T0b8BVUFrLmORplfcyCnNrr+4hCh/zcJzoCBCPF7ET4= Received: from MN2PR18MB2848.namprd18.prod.outlook.com (20.179.21.149) by MN2PR18MB2382.namprd18.prod.outlook.com (20.179.81.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2052.18; Fri, 5 Jul 2019 10:05:12 +0000 Received: from MN2PR18MB2848.namprd18.prod.outlook.com ([fe80::4447:9459:5386:2e18]) by MN2PR18MB2848.namprd18.prod.outlook.com ([fe80::4447:9459:5386:2e18%7]) with mapi id 15.20.2052.019; Fri, 5 Jul 2019 10:05:12 +0000 From: Harman Kalra To: "thomas@monjalon.net" , "david.hunt@intel.com" , "ferruh.yigit@linux.intel.com" CC: "dev@dpdk.org" , Jerin Jacob Kollanukkaran , Harman Kalra , "stable@dpdk.org" Thread-Topic: [PATCH v3 2/2] distributor: fix additional check on no of workers Thread-Index: AQHVMxkiL22z/3AwUEKogdAMKtMa9w== Date: Fri, 5 Jul 2019 10:05:12 +0000 Message-ID: <1562321046-25195-2-git-send-email-hkalra@marvell.com> References: <223181000.veHZD1QNU4@xps> <1562321046-25195-1-git-send-email-hkalra@marvell.com> In-Reply-To: <1562321046-25195-1-git-send-email-hkalra@marvell.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BMXPR01CA0070.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:2c::34) To MN2PR18MB2848.namprd18.prod.outlook.com (2603:10b6:208:3e::21) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.7.4 x-originating-ip: [115.113.156.2] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 919cbca6-47f7-451e-d51c-08d7013044f1 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(2017052603328)(7193020); SRVR:MN2PR18MB2382; x-ms-traffictypediagnostic: MN2PR18MB2382: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:376; x-forefront-prvs: 008960E8EC x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(39850400004)(346002)(136003)(376002)(366004)(396003)(189003)(199004)(54906003)(14444005)(110136005)(478600001)(6512007)(52116002)(5660300002)(50226002)(2501003)(316002)(71190400001)(71200400001)(66066001)(76176011)(6116002)(3846002)(256004)(68736007)(86362001)(6506007)(446003)(26005)(186003)(386003)(2201001)(102836004)(55236004)(25786009)(486006)(6436002)(2616005)(476003)(11346002)(4326008)(6486002)(14454004)(36756003)(66946007)(8936002)(66446008)(2906002)(81156014)(53936002)(81166006)(8676002)(64756008)(66556008)(7736002)(99286004)(66476007)(305945005)(73956011); DIR:OUT; SFP:1101; SCL:1; SRVR:MN2PR18MB2382; H:MN2PR18MB2848.namprd18.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: marvell.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: j5BdPJK6Rl+exzd7nMdOiYu6ZnVQh8/E7KBo1bQboJsnRf0oyO8hJDDHVX8bxNSoDvcs9e3q0U/9jP7E54W/W2tAUq6vkfkpvxbWGM4+ySvMj3b0slY8bPhlR+ViPdVdw/cPqfkao0B+dqZABZ1eBKWfh5WVIAQ2Zfua4lNMZxxP3N+krGtM+Nkn7F4AOwvhDSl39r8xb5Er+nH2NunH08FKsYWauFktw388T7uPjcTkF3srn6o4XXjkCAaWIrcU59e88wFqxixCWoGN34LjnUX4qi9VFhhlrkwJDobiwzrqF51L6Rl7Z8Dlu3RniSXl52ab7Ij5O7fHKe6k71yOuj4LxdMiI26+A1whELrz8cG2L1upftbHAKrArhVTx0frCkhTAUJxqIWoam536PbGwnSRZ09K/O4xwEgpWJeaMBU= Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 919cbca6-47f7-451e-d51c-08d7013044f1 X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Jul 2019 10:05:12.4670 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: hkalra@marvell.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR18MB2382 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-07-05_04:, , signatures=0 Subject: [dpdk-stable] [PATCH v3 2/2] distributor: fix additional check on no of workers X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" No of workers should never exceed RTE_MAX_LCORE. RTE_DIST_ALG_SINGLE also require no of workers check. Fixes: 775003ad2f96 ("distributor: add new burst-capable library") Cc: stable@dpdk.org Signed-off-by: Harman Kalra --- lib/librte_distributor/rte_distributor.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/librte_distributor/rte_distributor.c b/lib/librte_distribu= tor/rte_distributor.c index 208abfb1d..bfcc536fd 100644 --- a/lib/librte_distributor/rte_distributor.c +++ b/lib/librte_distributor/rte_distributor.c @@ -595,6 +595,12 @@ rte_distributor_create_v1705(const char *name, RTE_BUILD_BUG_ON((sizeof(*d) & RTE_CACHE_LINE_MASK) !=3D 0); RTE_BUILD_BUG_ON((RTE_DISTRIB_MAX_WORKERS & 7) !=3D 0); =20 + if (name =3D=3D NULL || num_workers >=3D + (unsigned int)RTE_MIN(RTE_DISTRIB_MAX_WORKERS, RTE_MAX_LCORE)) { + rte_errno =3D EINVAL; + return NULL; + } + if (alg_type =3D=3D RTE_DIST_ALG_SINGLE) { d =3D malloc(sizeof(struct rte_distributor)); if (d =3D=3D NULL) { @@ -612,11 +618,6 @@ rte_distributor_create_v1705(const char *name, return d; } =20 - if (name =3D=3D NULL || num_workers >=3D RTE_DISTRIB_MAX_WORKERS) { - rte_errno =3D EINVAL; - return NULL; - } - snprintf(mz_name, sizeof(mz_name), RTE_DISTRIB_PREFIX"%s", name); mz =3D rte_memzone_reserve(mz_name, sizeof(*d), socket_id, NO_FLAGS); if (mz =3D=3D NULL) { --=20 2.18.0