From patchwork Fri Oct 14 08:49:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Elo, Matias \(Nokia - FI/Espoo\)" X-Patchwork-Id: 77646 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp196577qge; Fri, 14 Oct 2016 01:50:03 -0700 (PDT) X-Received: by 10.55.148.3 with SMTP id w3mr10117034qkd.248.1476435002952; Fri, 14 Oct 2016 01:50:02 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id v18si7586971qtv.57.2016.10.14.01.50.02; Fri, 14 Oct 2016 01:50:02 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE dis=NONE) header.from=nokia.com Received: by lists.linaro.org (Postfix, from userid 109) id 8ADF760E52; Fri, 14 Oct 2016 08:50:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAD_ENC_HEADER,BAYES_00, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 1AFF260E57; Fri, 14 Oct 2016 08:49:31 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 3024660A34; Fri, 14 Oct 2016 08:49:28 +0000 (UTC) Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20093.outbound.protection.outlook.com [40.107.2.93]) by lists.linaro.org (Postfix) with ESMTPS id DBBBF609FB for ; Fri, 14 Oct 2016 08:49:26 +0000 (UTC) Received: from DB6PR0701CA0028.eurprd07.prod.outlook.com (10.168.7.166) by HE1PR0701MB2940.eurprd07.prod.outlook.com (10.168.93.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.669.5; Fri, 14 Oct 2016 08:49:24 +0000 Received: from AM1FFO11OLC005.protection.gbl (2a01:111:f400:7e00::161) by DB6PR0701CA0028.outlook.office365.com (2603:10a6:4:3::38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.679.4 via Frontend Transport; Fri, 14 Oct 2016 08:49:25 +0000 Received-SPF: Pass (protection.outlook.com: domain of nokia.com designates 131.228.2.241 as permitted sender) receiver=protection.outlook.com; client-ip=131.228.2.241; helo=fihe3nok0735.emea.nsn-net.net; Received: from fihe3nok0735.emea.nsn-net.net (131.228.2.241) by AM1FFO11OLC005.mail.protection.outlook.com (10.174.64.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.669.7 via Frontend Transport; Fri, 14 Oct 2016 08:49:24 +0000 Received: from fihe3nok0735.emea.nsn-net.net (localhost [127.0.0.1]) by fihe3nok0735.emea.nsn-net.net (8.14.9/8.14.5) with ESMTP id u9E8nCj1005829 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 14 Oct 2016 11:49:12 +0300 Received: from 10.144.19.15 ([10.144.104.92]) by fihe3nok0735.emea.nsn-net.net (8.14.9/8.14.5) with ESMTP id u9E8nCVp005806 (version=TLSv1/SSLv3 cipher=AES128-SHA256 bits=128 verify=NOT) for ; Fri, 14 Oct 2016 11:49:12 +0300 X-HPESVCS-Source-Ip: 10.144.104.92 From: Matias Elo To: Date: Fri, 14 Oct 2016 11:49:12 +0300 Message-ID: <1476434952-8282-6-git-send-email-matias.elo@nokia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1476434952-8282-1-git-send-email-matias.elo@nokia.com> References: <1476434952-8282-1-git-send-email-matias.elo@nokia.com> X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:131.228.2.241; IPV:NLI; CTRY:FI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(7916002)(2980300002)(438002)(199003)(189002)(6916009)(97736004)(19580395003)(2351001)(19580405001)(106466001)(229853001)(2950100002)(42882006)(7846002)(5660300001)(450100001)(110136003)(50986999)(92566002)(36756003)(68736007)(8936002)(305945005)(5003940100001)(626004)(586003)(356003)(77096005)(47776003)(11100500001)(48376002)(8676002)(50226002)(50466002)(81156014)(87936001)(76176999)(33646002)(107886002)(81166006)(189998001)(2906002)(217873001); DIR:OUT; SFP:1102; SCL:1; SRVR:HE1PR0701MB2940; H:fihe3nok0735.emea.nsn-net.net; FPR:; SPF:Pass; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; AM1FFO11OLC005; 1:Y+1qTYh6el8Pk9brfzoGt22hOWctY+tA4WZ3YpTPNnWV7eWvCoUQviTHCNGA7SaqvNggzjcesxsAetwnM9vf87+9oB+k/sC7iniRBNriJA6FpB7L+64VnzNtXAw1kJebM74+iFXumZ+kGikzsq2SewAWQpvoLU4EyhErPpsgGdRMdV2aEGdAvmA3JAZ4ubf6aFHkgPDllWnNgyspLm/aqleXFcAXHIcazgpmezf28ETqvOW1qnaGkpuW8V0yE7y6Gxms1LdhLE6UcvDY5nV+S2Rbcf6Bxljpy6n489JAGbHy2vPjatOKJDY2nK6iI5xAcTDBm8BD29fHrBb9SgHXoo/kcLdg1kgJiEbgHZrpIVp+pPkOKi6IktiGpC+CwncncAWSpa3rkrxGc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TTQE1ywRTMrk8LXNiH+wr5dD/vR8= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(82608151540597); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(13016025)(5005006)(13018025)(8121501046)(10201501046)(3002001)(6055026); SRVR:HE1PR0701MB2940; BCL:0; PCL:0; RULEID:; SRVR:HE1PR0701MB2940; X-Microsoft-Exchange-Diagnostics: 1; HE1PR0701MB2940; 4:DZBVSDiEo5Y0qw6JhLjbaKIZ8GDr8N8X8971CP/GNevF5MLpJeKhfi7W6nVB/uU5VZr6fvpUMgX1ET0TrqjVauA9ym86Y71yF9/hOiSRmuCbSKBO1oaYM29OjtkHCMuEmvJhEieD0K9x1iu4xAtUw/YjRO56QCDXlxC84vcLTzqPFxXyYWbWCtiZf9w/QdkLjyvEFxmTrIZSd7ZFPcPq9U7yBrEXCwSsPe4xeL5aIqnEW7+Czsvt01UDVqFJNcaYcdprp5MNxEsa6R+5699Xk+6Ibd3myTs3GoJep6V79XpInXB/Qjioxa3lLmUNlVgtVysLwTDihqgUE4eieRvKMGj5rK8mBCjArAEcdihBGdz9uIf7QNsC7ShDYLbbbb5BuWKAejdQgtX84cfS8BZsx/gxWNjUlYzReT849hf0DoSVyppUAXnk8rE97TukTgOPgT2JynsfFIW00txC7Sgv8LfebLCCHDXevsGuRbJJTDWCfvTYkQg3k7aFZIusD+T7 X-Forefront-PRVS: 0095BCF226 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; HE1PR0701MB2940; 23:4l3hSLvRIr/C8sPeXz0uuBZ0wndxzqKXAuGu6VW?= =?us-ascii?Q?HCdTaAn7/nDlfUNmFYwyxZ63DZybgE9L8Tiew+aKlnuADUzCK1j0Cid2rAox?= =?us-ascii?Q?w7cOL/EFDy9BQfDqZxYthbmeT7UGIte/yDmgryYCQtEVKOGs01n7EVxGKoHE?= =?us-ascii?Q?FiRG+4yxoRBCIDP62T8S5/3zt8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gKYzap+mdjfiVjQWXUsHsBclSDAEKbgMqnH9oqj+CYRkpsvat6cAPtNz7Tbs?= =?us-ascii?Q?boQasXI4BWMOrZvY7kDxkrtgy/thG4Lcy?= X-Microsoft-Exchange-Diagnostics: 1; HE1PR0701MB2940; 6:IrFtq2Vb6aHGeC/33u742J8A3VAphGvDqihQWJYkUqL5rS+oaz8/TMl1rhDGvleaD0Bz+TlXu54MaXn1ziiu7Z++/k0qvIVwT014uYmCFqwdKp2daXK5KS8CzTfBDeQaRyOjqt/CIM0x9QyruENwFvr/U64FlrqPwN8EaLqWYggJ6ZhA9EbWA2H3cfMcCFFZ6GA3rz/XYQsVcxSPOL6QqjKfscY4nxaqlRAnodL2wY75yZWFQpjwGavmNR02xRKrDLiBEeVBic5XmnbEm34VN89O9Y1E06umFhaRL7S0uWP7j9QkyYM4/S7Pa034NCyppu222eGIE2aaUbnjG1ROUgyQN/cJyRo9fQZ/UigRZmI=; 5:uLFLt/nRYS47dEPSd3uLmD5btiT3ryK/kJ50+v58oBycC7FxjLEtm9egyPYj7tPFB414oxvh3rQsuBZo1MceKX153dPmcRF25nmknm9kE75/PROfU00il5RVxVuFd7liJfTjux73XSAHNVvUYE4yMA==; 24:CWNFP9ttToOFJfAnQpbbjSFqjKuTYJxUmtstJCq+pZ3Ztr40bDacHye7zNNx0MEVSyTGYrQOKtaA61iuS0YWqFEEpR5MmhIjmYO42p8wjRc= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; HE1PR0701MB2940; 7:vUImB00hVucbnw74pqC0Wbp3E2VmHEkis2RU39JanPwsWFSicAAQjUKWou08Y0Ciysr2+8a8Mf6hXTJw/5Lk+1CbaYfHzZnVMA6vTs9GPgmSyGQJEWzPl7cXOgWc0xgBb5plCmJU5L5BOM3+mNMdWOfwTjb220pIYYaSxIr41sp3Yv05qAh/5j5Xqh+eOCNUon5sFkieDwtPutCjpVLAO8eoW8i0/wGVEOEgOs8ygZN1B6+OBE7SqSiT9ssJzsdgEJJI46W7lhSKZDZHCu+Oqu2C9GLvXSa5SXuVXVjFvHOQKzcwh6prMfb7L/+CiFeQRn5wrR42B5KbNSzNrI1S6JwLHT+u7pV3qMauFJ4zm+8= X-OriginatorOrg: nokia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Oct 2016 08:49:24.1356 (UTC) X-MS-Exchange-CrossTenant-Id: 5d471751-9675-428d-917b-70f44f9630b0 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5d471751-9675-428d-917b-70f44f9630b0; Ip=[131.228.2.241]; Helo=[fihe3nok0735.emea.nsn-net.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0701MB2940 X-Topics: timers patch Subject: [lng-odp] [API-NEXT PATCH 5/5] linux-gen: timer: fix creating timer pool with no name X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" Previously trying to create a timer pool with no name (=NULL) caused a segfault. Signed-off-by: Matias Elo --- platform/linux-generic/odp_timer.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) -- 2.7.4 diff --git a/platform/linux-generic/odp_timer.c b/platform/linux-generic/odp_timer.c index becea9d..22b7205 100644 --- a/platform/linux-generic/odp_timer.c +++ b/platform/linux-generic/odp_timer.c @@ -222,7 +222,7 @@ static inline odp_timer_t tp_idx_to_handle(struct odp_timer_pool_s *tp, static void itimer_init(odp_timer_pool *tp); static void itimer_fini(odp_timer_pool *tp); -static odp_timer_pool_t odp_timer_pool_new(const char *_name, +static odp_timer_pool_t odp_timer_pool_new(const char *name, const odp_timer_pool_param_t *param) { uint32_t tp_idx = odp_atomic_fetch_add_u32(&num_timer_pools, 1); @@ -238,14 +238,20 @@ static odp_timer_pool_t odp_timer_pool_new(const char *_name, ODP_CACHE_LINE_SIZE); size_t sz2 = ODP_ALIGN_ROUNDUP(sizeof(odp_timer) * param->num_timers, ODP_CACHE_LINE_SIZE); - odp_shm_t shm = odp_shm_reserve(_name, sz0 + sz1 + sz2, + odp_shm_t shm = odp_shm_reserve(name, sz0 + sz1 + sz2, ODP_CACHE_LINE_SIZE, ODP_SHM_SW_ONLY); if (odp_unlikely(shm == ODP_SHM_INVALID)) ODP_ABORT("%s: timer pool shm-alloc(%zuKB) failed\n", - _name, (sz0 + sz1 + sz2) / 1024); + name, (sz0 + sz1 + sz2) / 1024); odp_timer_pool *tp = (odp_timer_pool *)odp_shm_addr(shm); odp_atomic_init_u64(&tp->cur_tick, 0); - snprintf(tp->name, sizeof(tp->name), "%s", _name); + + if (name == NULL) { + tp->name[0] = 0; + } else { + strncpy(tp->name, name, ODP_TIMER_POOL_NAME_LEN - 1); + tp->name[ODP_TIMER_POOL_NAME_LEN - 1] = 0; + } tp->shm = shm; tp->param = *param; tp->min_rel_tck = odp_timer_ns_to_tick(tp, param->min_tmo);