From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20045.outbound.protection.outlook.com [40.107.2.45]) by dpdk.org (Postfix) with ESMTP id 44BA54C8E for ; Tue, 12 Mar 2019 22:43:34 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xdnRRXXw5X4ZTxTm8o+jAkzBLTo/Fg3QIIJT+OwJtwY=; b=LTDEj/hDdEzMqYEvSQLor2lhlfJfpueUiegwxheuq5A7ujIS6Z5sjSN9sq21RLUx2UeRtJ2vrCNfyOg0ZngCI4ctRNJ48kPdbTsp72O8viOqRGpKemwMWg6++7ROgFOHQMDn6MyIP2fQlthNQZdE75pe+l5667SPTJWl+0a9zY4= Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com (52.134.72.27) by DB3PR0502MB3945.eurprd05.prod.outlook.com (52.134.65.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1686.18; Tue, 12 Mar 2019 21:43:31 +0000 Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com ([fe80::580c:ae7b:8278:cc50]) by DB3PR0502MB3980.eurprd05.prod.outlook.com ([fe80::580c:ae7b:8278:cc50%3]) with mapi id 15.20.1709.011; Tue, 12 Mar 2019 21:43:31 +0000 From: Yongseok Koh To: "Burakov, Anatoly" CC: dpdk stable Thread-Topic: please check if patch 'eal: fix strdup usages in internal config' is applicable to LTS release 17.11.6 Thread-Index: AQHU1/JTcD+mqUZjZ0+yl+GzLFONeaYIiWCA Date: Tue, 12 Mar 2019 21:43:31 +0000 Message-ID: <294E8C7A-0DD7-45DF-B74C-4BE6FC35CA7E@mellanox.com> References: <20190308180901.31938-1-yskoh@mellanox.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=yskoh@mellanox.com; x-originating-ip: [209.116.155.178] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: f9fe6ba3-816f-4fed-1e6a-08d6a733c587 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600127)(711020)(4605104)(4618075)(2017052603328)(7153060)(7193020); SRVR:DB3PR0502MB3945; x-ms-traffictypediagnostic: DB3PR0502MB3945: x-ms-exchange-purlcount: 1 x-microsoft-exchange-diagnostics: =?us-ascii?Q?1; DB3PR0502MB3945; 23:3W/0kqZWFKugTq9VHfAIm233QX5yn53DuZj+R5s?= =?us-ascii?Q?G6xo3jD+LY4+xzTTGZ8hA0LNmGGUtegam7rrRxJXSPx/NdIHXsLpFM2hZrjP?= =?us-ascii?Q?gq5sUKy+zTnDMJAWyhKZLuUBTAgYCkp6H2+TF0+haz9U5eUg3C2gJ7HdO0Eo?= =?us-ascii?Q?mAHj9TofrrI7suEG4HdMaQOBFTgrDOAlEi+/TlC26rMZqNNc6u59Fx6yLrck?= =?us-ascii?Q?aNCDAiqeIfoSzWH4Er7esMKYQjDl4k0kloh2Ysh47ExyFcsQWaR3fFnMQU9X?= =?us-ascii?Q?7nJrjPX+M9Qwl1A1dBDGYhSeCBn6ZTJCBzTOdQJO4c3XJrfYu0nKc8oDpjgr?= =?us-ascii?Q?YDTF48NBbP4fSZxoTg+2UDSb8RERC35V3vDS6uwQDQEFsejun3ZAuHk6G6Ch?= =?us-ascii?Q?4qhco2PW75cpI7B9Zw+YsE4p+Xe2XmeQ+0aMZRDxXesqReP5S9IG6kNqJ290?= =?us-ascii?Q?N7qCakMcJ80tA654w/TD+/ME3UgZCgbAlQHgSs6TFMbuJDNbboDod18+hrtX?= =?us-ascii?Q?FFh7Trlt1VJjndCafp3VVe6ByDtctvJZALGKtS4up7FGlW0vPmVJOX+bk1jG?= =?us-ascii?Q?NPPS2O2VnkKlVZdwqS/Y4/XJhoN2jAFtm9r1RnLdNdSb0ZTlXnIYoz76+gSM?= =?us-ascii?Q?LUJP0p4RGP+Idk68XECHXz7gtMUsGjQtU5965TuqhzyM1hT6Y5cgTdqTL8tq?= =?us-ascii?Q?EtLHfVaQ/lTBWzqtrlLyXsoP1kyH7X21HEysUyjCj7nfHJX9jwhmVfbmc1F9?= =?us-ascii?Q?QUieetweYzVN8+9wymKs99W6it59du7FtDviS5PDBQlS91SDS8WIhjB64bG/?= =?us-ascii?Q?8NVryhReINTb8I0bMK+uq6EUAHDrnWsF11UC6qJybRDvqeFSHdAgLO6gGx3i?= =?us-ascii?Q?KYACfkfDz+61bYftMBWV8WgLG2WaGcDi+ZQqzXLifZ+pbXRgoz4KcZE2GMeF?= =?us-ascii?Q?+kRcOzLcgxtW66Wz2zjVDC8XS6Sz0C+JBJV3h9GwpbnQ18Scf8xqvCrePFEo?= =?us-ascii?Q?Nz+Ap/Rj0FcP9Q5oYbYNiL2H8MwPN5Z26oO052COh5pjeFsGq9GFJwTawMbt?= =?us-ascii?Q?+MpxGxUbeNMV68gFDXWQLt2jzsLircEc0qm4EzHaGPzXyHx0F12Ng9ePIQEl?= =?us-ascii?Q?5mKnCDLx+as9PWN7X1x52bqV+Y7/wPiYl6xqlaxmfnPrsUCMdz4P5C1VHhbM?= =?us-ascii?Q?1xyQkS7UqLSWh3lOYcsfOL/cQd5Kwle3oVWKkgdgyI2cRqtw0eKrdJhBkNZ6?= =?us-ascii?Q?aEn+LWhfo/l9aXtaLCmXkSgx8nc7hdDG6KvO05/X43cWksWs7BRl9hqwPVqm?= =?us-ascii?Q?2w1is9Rkts5tNt6Dt6lRB0cDi3sVxX66HNmOqrLZzL8+SYIvoLHihT+4JwmD?= =?us-ascii?Q?j7vOAspXJ2RWQ9ELzvXQkH93LvgpH79/R0RPoW/nFOvirQUeIQDiTOwZvzW+?= =?us-ascii?Q?Zu0x1loJq+LWp+vT8cK+uwPoFx2Uq55589KoORg9WrGR8NZieSRX8M75uWrF?= =?us-ascii?Q?Q79boou2Sw9ZxEQ=3D=3D?= x-microsoft-antispam-prvs: x-forefront-prvs: 09749A275C x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(979002)(376002)(366004)(136003)(346002)(396003)(39860400002)(199004)(189003)(28163001)(13464003)(99286004)(186003)(106356001)(68736007)(6916009)(6246003)(105586002)(97736004)(36756003)(4326008)(25786009)(86362001)(66066001)(30864003)(26005)(6116002)(3846002)(45080400002)(6506007)(6306002)(316002)(53546011)(7736002)(229853002)(6436002)(8676002)(71200400001)(81156014)(8936002)(446003)(53936002)(14444005)(256004)(6512007)(71190400001)(305945005)(11346002)(476003)(33656002)(81166006)(486006)(6486002)(478600001)(102836004)(5660300002)(14454004)(966005)(2906002)(76176011)(82746002)(2616005)(83716004)(21314003)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:DB3PR0502MB3945; H:DB3PR0502MB3980.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: go9IN3nE5EJNjM2hw6jyj6Df2OM16apx9rHV8UJH3LOb3UdKPj6pUOJOA448oNYOcic4uBuwKEH/LPhesvEb5mCS13Rl/B4wWMTXSuJFJoHvWVtoJ+i04zT79eFjExlbykYP1KxDYBSFh1fR7I28UybFc5yIKQx36GZTxkHdRpE/PFuQh8L6zy13p81HstXaESrPqnFM9+BszUPPrOwnFbXxNuTHMN4PIP4hQoloudQAVQLcawoqw+JmGBQPv80DR0ZcGPnNF+SzcAG67zXeJ58es2saPVN8IT7e5Sk3baXqosW3eDy6fAbUAKDEk7h0vebDSJBVjl9xJsSvw0gxFS1bilmR0E7QjfrEqk1Qb9ApSST1UMKyCXgkYgs1peOJHLyLR40ndPuvThHZttCKokx7ulK0tJXw5zd+2ySXdKs= Content-Type: text/plain; charset="us-ascii" Content-ID: <5FEFC44625E5E140AADC9B90457601C4@eurprd05.prod.outlook.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: f9fe6ba3-816f-4fed-1e6a-08d6a733c587 X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Mar 2019 21:43:31.6679 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR0502MB3945 Subject: Re: [dpdk-stable] please check if patch 'eal: fix strdup usages in internal config' is applicable to LTS release 17.11.6 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: , X-List-Received-Date: Tue, 12 Mar 2019 21:43:34 -0000 Okay will not merge it then. Thanks, Yongseok > On Mar 11, 2019, at 3:08 AM, Burakov, Anatoly = wrote: >=20 > It's not a critical bugfix, so it can be left out of it is deemed too muc= h change for a stable release. However, it is indeed applicable to stable, = and can be merged. >=20 > Thanks, > Anatoly >=20 >=20 >> -----Original Message----- >> From: Yongseok Koh [mailto:yskoh@mellanox.com] >> Sent: Friday, March 8, 2019 6:09 PM >> To: Burakov, Anatoly >> Cc: dpdk stable >> Subject: please check if patch 'eal: fix strdup usages in internal confi= g' is >> applicable to LTS release 17.11.6 >>=20 >> Hi, >>=20 >> Even though the patch doesn't have "Cc: stable@dpdk.org" tag or "Fixes:" >> tag, the commit log says it fixes some issue. Tags might be mistakenly m= issed. >> We don't want to miss any fixes for stable releases. That's why I'm send= ing >> this email. >>=20 >> Please send backports if you think the patch should be merged to LTS rel= ease >> 17.11.6 Or, let me know if you have any comments, say, need more time, o= r >> it's worthless to backport it. And please send it to "stable@dpdk.org", = but >> not "dev@dpdk.org". >>=20 >> FYI, branch 17.11 is located at tree: >> git://dpdk.org/dpdk-stable >>=20 >> It'd be great if you could do that in one or two weeks. Also, please add= a >> heading line like below before the commit log body: >> [ backported from upstream commit xxx ] >>=20 >> Example: https://emea01.safelinks.protection.outlook.com/?url=3Dhttp%3A%= 2F%2Fdpdk.org%2Fbrowse%2Fdpdk-&data=3D02%7C01%7Cyskoh%40mellanox.com%7C= 3d7486372a674d3f22a108d6a60974d8%7Ca652971c7d2e4d9ba6a4d149256f461b%7C0%7C0= %7C636878956887750739&sdata=3DkYJAXumgJWJqqb%2BUSAkXdBusXo%2FEp%2FqL25t= xtHXH%2FHs%3D&reserved=3D0 >> stable/commit/?h=3D16.07&id=3Dc4831394c7d1944d8ec27d52c22997f20d19718e >>=20 >> Also please mention the target LTS in the subject line, as we have more = than >> one at the same time, for example: >>=20 >> [PATCH 17.11] foo/bar: fix baz >>=20 >> With git send-email, this can be achieved by appending the parameter: >>=20 >> --subject-prefix=3D'17.11' >>=20 >>=20 >> Thanks. >>=20 >> Yongseok >>=20 >> --- >> From 66d9f61de0885bd07662a016542600fe139d4eed Mon Sep 17 00:00:00 >> 2001 >> From: Anatoly Burakov >> Date: Thu, 10 Jan 2019 13:38:59 +0000 >> Subject: [PATCH] eal: fix strdup usages in internal config >>=20 >> Currently, we use strdup in a few places to store command-line parameter >> values for certain internal config values. There are several issues with= that. >>=20 >> First of all, they're never freed, so memory ends up leaking either afte= r EAL >> exit, or when these command-line options are supplied multiple times. >>=20 >> Second of all, they're defined as `const char *`, so they >> *cannot* be freed even if we wanted to. >>=20 >> Finally, strdup may return NULL, which will be stored in the config. For= most >> fields, NULL is a valid value, but for the default prefix, the value is = always >> expected to be valid. >>=20 >> To fix all of this, three things are done. First, we change the definiti= ons of >> these values to `char *` as opposed to `const char *`. This does not bre= ak the >> ABI, and previous code assumes constness (which is more restrictive), so= it's >> safe to do so. >>=20 >> Then, fix all usages of strdup to check return value, and add a cleanup >> function that will free the memory occupied by these strings, as well as >> freeing them before assigning a new value to prevent leaks when paramete= r >> is specified multiple times. >>=20 >> And finally, add an internal API to query hugefile prefix, so that, abse= nt of a >> valid value, a default value will be returned, and also fix up all usage= s of >> hugefile prefix to use this API instead of accessing hugefile prefix dir= ectly. >>=20 >> Bugzilla ID: 108 >>=20 >> Signed-off-by: Anatoly Burakov >> --- >> lib/librte_eal/bsdapp/eal/eal.c | 19 ++++++++++-- >> lib/librte_eal/common/eal_common_options.c | 25 ++++++++++++++-- >> lib/librte_eal/common/eal_filesystem.h | 6 +++- >> lib/librte_eal/common/eal_internal_cfg.h | 6 ++-- >> lib/librte_eal/common/eal_options.h | 1 + >> lib/librte_eal/linuxapp/eal/eal.c | 46 ++++++++++++++++++++++++= ---- >> -- >> lib/librte_eal/linuxapp/eal/eal_memory.c | 2 +- >> 7 files changed, 87 insertions(+), 18 deletions(-) >>=20 >> diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal= /eal.c >> index c8e0da097..1ba9bd7cf 100644 >> --- a/lib/librte_eal/bsdapp/eal/eal.c >> +++ b/lib/librte_eal/bsdapp/eal/eal.c >> @@ -117,7 +117,7 @@ eal_create_runtime_dir(void) >>=20 >> /* create prefix-specific subdirectory under DPDK runtime dir */ >> ret =3D snprintf(runtime_dir, sizeof(runtime_dir), "%s/%s", >> - tmp, internal_config.hugefile_prefix); >> + tmp, eal_get_hugefile_prefix()); >> if (ret < 0 || ret =3D=3D sizeof(runtime_dir)) { >> RTE_LOG(ERR, EAL, "Error creating prefix-specific runtime >> path name\n"); >> return -1; >> @@ -535,9 +535,21 @@ eal_parse_args(int argc, char **argv) >>=20 >> switch (opt) { >> case OPT_MBUF_POOL_OPS_NAME_NUM: >> - internal_config.user_mbuf_pool_ops_name =3D >> - strdup(optarg); >> + { >> + char *ops_name =3D strdup(optarg); >> + if (ops_name =3D=3D NULL) >> + RTE_LOG(ERR, EAL, "Could not store mbuf >> pool ops name\n"); >> + else { >> + /* free old ops name */ >> + if >> (internal_config.user_mbuf_pool_ops_name !=3D >> + NULL) >> + >> free(internal_config.user_mbuf_pool_ops_name); >> + >> + internal_config.user_mbuf_pool_ops_name >> =3D >> + ops_name; >> + } >> break; >> + } >> case 'h': >> eal_usage(prgname); >> exit(EXIT_SUCCESS); >> @@ -923,6 +935,7 @@ rte_eal_cleanup(void) { >> rte_service_finalize(); >> rte_mp_channel_cleanup(); >> + eal_cleanup_config(&internal_config); >> return 0; >> } >>=20 >> diff --git a/lib/librte_eal/common/eal_common_options.c >> b/lib/librte_eal/common/eal_common_options.c >> index 6e3a83b98..a2d862b5f 100644 >> --- a/lib/librte_eal/common/eal_common_options.c >> +++ b/lib/librte_eal/common/eal_common_options.c >> @@ -169,6 +169,14 @@ eal_option_device_parse(void) >> return ret; >> } >>=20 >> +const char * >> +eal_get_hugefile_prefix(void) >> +{ >> + if (internal_config.hugefile_prefix !=3D NULL) >> + return internal_config.hugefile_prefix; >> + return HUGEFILE_PREFIX_DEFAULT; >> +} >> + >> void >> eal_reset_internal_config(struct internal_config *internal_cfg) { @@ -1= 77,7 >> +185,7 @@ eal_reset_internal_config(struct internal_config *internal_cfg= ) >> internal_cfg->memory =3D 0; >> internal_cfg->force_nrank =3D 0; >> internal_cfg->force_nchannel =3D 0; >> - internal_cfg->hugefile_prefix =3D HUGEFILE_PREFIX_DEFAULT; >> + internal_cfg->hugefile_prefix =3D NULL; >> internal_cfg->hugepage_dir =3D NULL; >> internal_cfg->force_sockets =3D 0; >> /* zero out the NUMA config */ >> @@ -1348,6 +1356,19 @@ eal_auto_detect_cores(struct rte_config *cfg) } >>=20 >> int >> +eal_cleanup_config(struct internal_config *internal_cfg) { >> + if (internal_cfg->hugefile_prefix !=3D NULL) >> + free(internal_cfg->hugefile_prefix); >> + if (internal_cfg->hugepage_dir !=3D NULL) >> + free(internal_cfg->hugepage_dir); >> + if (internal_cfg->user_mbuf_pool_ops_name !=3D NULL) >> + free(internal_cfg->user_mbuf_pool_ops_name); >> + >> + return 0; >> +} >> + >> +int >> eal_adjust_config(struct internal_config *internal_cfg) { >> int i; >> @@ -1387,7 +1408,7 @@ eal_check_common_options(struct internal_config >> *internal_cfg) >> RTE_LOG(ERR, EAL, "Invalid process type specified\n"); >> return -1; >> } >> - if (index(internal_cfg->hugefile_prefix, '%') !=3D NULL) { >> + if (index(eal_get_hugefile_prefix(), '%') !=3D NULL) { >> RTE_LOG(ERR, EAL, "Invalid char, '%%', in -- >> "OPT_FILE_PREFIX" " >> "option\n"); >> return -1; >> diff --git a/lib/librte_eal/common/eal_filesystem.h >> b/lib/librte_eal/common/eal_filesystem.h >> index 64a028db7..89a3added 100644 >> --- a/lib/librte_eal/common/eal_filesystem.h >> +++ b/lib/librte_eal/common/eal_filesystem.h >> @@ -28,6 +28,10 @@ eal_create_runtime_dir(void); int >> eal_clean_runtime_dir(void); >>=20 >> +/** Function to return hugefile prefix that's currently set up */ const >> +char * eal_get_hugefile_prefix(void); >> + >> #define RUNTIME_CONFIG_FNAME "config" >> static inline const char * >> eal_runtime_config_path(void) >> @@ -89,7 +93,7 @@ static inline const char * eal_get_hugefile_path(char >> *buffer, size_t buflen, const char *hugedir, int f_id) { >> snprintf(buffer, buflen, HUGEFILE_FMT, hugedir, >> - internal_config.hugefile_prefix, f_id); >> + eal_get_hugefile_prefix(), f_id); >> buffer[buflen - 1] =3D '\0'; >> return buffer; >> } >> diff --git a/lib/librte_eal/common/eal_internal_cfg.h >> b/lib/librte_eal/common/eal_internal_cfg.h >> index 98e314fef..60eaead8f 100644 >> --- a/lib/librte_eal/common/eal_internal_cfg.h >> +++ b/lib/librte_eal/common/eal_internal_cfg.h >> @@ -66,9 +66,9 @@ struct internal_config { >> volatile int syslog_facility; /**< facility passed to openlog() */ >> /** default interrupt mode for VFIO */ >> volatile enum rte_intr_mode vfio_intr_mode; >> - const char *hugefile_prefix; /**< the base filename of hugetlbfs >> files */ >> - const char *hugepage_dir; /**< specific hugetlbfs directory to >> use */ >> - const char *user_mbuf_pool_ops_name; >> + char *hugefile_prefix; /**< the base filename of hugetlbfs files = */ >> + char *hugepage_dir; /**< specific hugetlbfs directory to use *= / >> + char *user_mbuf_pool_ops_name; >> /**< user defined mbuf pool ops name */ >> unsigned num_hugepage_sizes; /**< how many sizes on this >> system */ >> struct hugepage_info hugepage_info[MAX_HUGEPAGE_SIZES]; >> diff --git a/lib/librte_eal/common/eal_options.h >> b/lib/librte_eal/common/eal_options.h >> index 1480c5d77..58ee9ae33 100644 >> --- a/lib/librte_eal/common/eal_options.h >> +++ b/lib/librte_eal/common/eal_options.h >> @@ -77,6 +77,7 @@ int eal_parse_common_option(int opt, const char >> *argv, >> struct internal_config *conf); >> int eal_option_device_parse(void); >> int eal_adjust_config(struct internal_config *internal_cfg); >> +int eal_cleanup_config(struct internal_config *internal_cfg); >> int eal_check_common_options(struct internal_config *internal_cfg); voi= d >> eal_common_usage(void); enum rte_proc_type_t >> eal_proc_type_detect(void); diff --git a/lib/librte_eal/linuxapp/eal/eal= .c >> b/lib/librte_eal/linuxapp/eal/eal.c >> index 2d8d470b8..a386829f3 100644 >> --- a/lib/librte_eal/linuxapp/eal/eal.c >> +++ b/lib/librte_eal/linuxapp/eal/eal.c >> @@ -125,7 +125,7 @@ eal_create_runtime_dir(void) >>=20 >> /* create prefix-specific subdirectory under DPDK runtime dir */ >> ret =3D snprintf(runtime_dir, sizeof(runtime_dir), "%s/%s", >> - tmp, internal_config.hugefile_prefix); >> + tmp, eal_get_hugefile_prefix()); >> if (ret < 0 || ret =3D=3D sizeof(runtime_dir)) { >> RTE_LOG(ERR, EAL, "Error creating prefix-specific runtime >> path name\n"); >> return -1; >> @@ -727,13 +727,31 @@ eal_parse_args(int argc, char **argv) >> exit(EXIT_SUCCESS); >>=20 >> case OPT_HUGE_DIR_NUM: >> - internal_config.hugepage_dir =3D strdup(optarg); >> + { >> + char *hdir =3D strdup(optarg); >> + if (hdir =3D=3D NULL) >> + RTE_LOG(ERR, EAL, "Could not store >> hugepage directory\n"); >> + else { >> + /* free old hugepage dir */ >> + if (internal_config.hugepage_dir !=3D NULL) >> + free(internal_config.hugepage_dir); >> + internal_config.hugepage_dir =3D hdir; >> + } >> break; >> - >> + } >> case OPT_FILE_PREFIX_NUM: >> - internal_config.hugefile_prefix =3D strdup(optarg); >> + { >> + char *prefix =3D strdup(optarg); >> + if (prefix =3D=3D NULL) >> + RTE_LOG(ERR, EAL, "Could not store file >> prefix\n"); >> + else { >> + /* free old prefix */ >> + if (internal_config.hugefile_prefix !=3D NULL) >> + free(internal_config.hugefile_prefix); >> + internal_config.hugefile_prefix =3D prefix; >> + } >> break; >> - >> + } >> case OPT_SOCKET_MEM_NUM: >> if (eal_parse_socket_arg(optarg, >> internal_config.socket_mem) < 0) { >> @@ -783,10 +801,21 @@ eal_parse_args(int argc, char **argv) >> break; >>=20 >> case OPT_MBUF_POOL_OPS_NAME_NUM: >> - internal_config.user_mbuf_pool_ops_name =3D >> - strdup(optarg); >> + { >> + char *ops_name =3D strdup(optarg); >> + if (ops_name =3D=3D NULL) >> + RTE_LOG(ERR, EAL, "Could not store mbuf >> pool ops name\n"); >> + else { >> + /* free old ops name */ >> + if >> (internal_config.user_mbuf_pool_ops_name !=3D >> + NULL) >> + >> free(internal_config.user_mbuf_pool_ops_name); >> + >> + internal_config.user_mbuf_pool_ops_name >> =3D >> + ops_name; >> + } >> break; >> - >> + } >> case OPT_MATCH_ALLOCATIONS_NUM: >> internal_config.match_allocations =3D 1; >> break; >> @@ -1238,6 +1267,7 @@ rte_eal_cleanup(void) >> rte_memseg_walk(mark_freeable, NULL); >> rte_service_finalize(); >> rte_mp_channel_cleanup(); >> + eal_cleanup_config(&internal_config); >> return 0; >> } >>=20 >> diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c >> b/lib/librte_eal/linuxapp/eal/eal_memory.c >> index 7d922a965..1b96b576e 100644 >> --- a/lib/librte_eal/linuxapp/eal/eal_memory.c >> +++ b/lib/librte_eal/linuxapp/eal/eal_memory.c >> @@ -438,7 +438,7 @@ find_numasocket(struct hugepage_file *hugepg_tbl, >> struct hugepage_info *hpi) >> } >>=20 >> snprintf(hugedir_str, sizeof(hugedir_str), >> - "%s/%s", hpi->hugedir, >> internal_config.hugefile_prefix); >> + "%s/%s", hpi->hugedir, eal_get_hugefile_prefix()); >>=20 >> /* parse numa map */ >> while (fgets(buf, sizeof(buf), f) !=3D NULL) { >> -- >> 2.11.0