From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id D0A2142820 for ; Thu, 23 Mar 2023 09:20:25 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C455B427E9; Thu, 23 Mar 2023 09:20:25 +0100 (CET) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2068.outbound.protection.outlook.com [40.107.220.68]) by mails.dpdk.org (Postfix) with ESMTP id 4BCD84021E; Thu, 23 Mar 2023 09:20:23 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YBl/ZRVbnGGZi9KUwPPpGTdUTmPzOh/jSqEPM5+XMQV6KzZ+kbV+bSDSE4HCPR69XlGQg81AtRrJ7RPo2sx4FgaXfERcoLQE0NC9ac2z3szYTpIOGxJccEEafQOKxgBmZBiGsBxxPhTj3oR78IaYrN//0CwK+N0pjhGo/78D/SbNwqL4vIoYGcyU/EmGtcNtzG8qNMRxhnKXt+N47P5PhiKx7nV/J3qEKAE18D4q/PMB/LT7Of76Oc7vFwzHeQLR5uzJZdsCN/8X3yhogZlDtBnpZZONKpnDM6n8KBmC4LdOVbXQxbzJLdZ3SJXRBACcYjQDF0uBS7xBf3a/JjPEpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Plr3qovK8SPFnT99Zw2Pj3v/AF+F4PH/jKzKmZ9seA0=; b=jeKX9mw85dY4J+Rk1l5gHbKeB5lv/yCr5qM3p76gfIdDSmaZyCNWxa1TtP5E7dnJ7/g9lbUKklOb9NNGRjGeNqPCG8zdUWBa5sTgyselVrsHlQoO3trefMV78qQGbAE5/QCKRbX5RTWn05IESiSpKyxA4u2OeRYyZHM24eoZwOOjllZmckRiG7GrogJw5Lb1FB0lut5ySrlZXfGTZXXubZ7CIAD7US6SlYO8gQL2t23u7i3KRe2w213V3gFNuynFE2n3WC6XSdCzqR24GxNq5WrNLw6ZrG9oaxMfbELH15wgUlhx0E+/lfetFTZ+9t8JgV8EvkIeijHM7ibTb4e7ww== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Plr3qovK8SPFnT99Zw2Pj3v/AF+F4PH/jKzKmZ9seA0=; b=GXO3W+A7I/IykVhaoqXncPcGXnNMc2y7YjA77eEdO9bYT6PNS4yw71nxX2EO14tchXkeRm6l2pimlOpkLMav4dHuYhCyfdKDAJucWiP88y13NNF/xXqVX+89ZsgY6UdVw2Ze3aBl0RUI9x5wx1gOinQVFfzQrrnZEKmPbno3IjmqqFev6R8yrvGLETQAgs5q9DBb9wxAjQcjRqLyEYUjZHui/t0nfqf6djXFzx2dfrPMEWF1v0pjPOBg7zYS687LJkgH2BwZqMdid7l6bO8YGTex75CaELsPY/FSRy8hCjgVZEqT+pLN6KEKWNDZqxBLqzt+7/CUuxqtBAbdTiBEgg== Received: from DM4PR12MB5184.namprd12.prod.outlook.com (2603:10b6:5:397::18) by MW6PR12MB8913.namprd12.prod.outlook.com (2603:10b6:303:247::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.38; Thu, 23 Mar 2023 08:20:21 +0000 Received: from DM4PR12MB5184.namprd12.prod.outlook.com ([fe80::1728:c308:1d15:ff2d]) by DM4PR12MB5184.namprd12.prod.outlook.com ([fe80::1728:c308:1d15:ff2d%8]) with mapi id 15.20.6178.037; Thu, 23 Mar 2023 08:20:21 +0000 From: Bing Zhao To: Stephen Hemminger CC: Slava Ovsiienko , Matan Azrad , "dev@dpdk.org" , Raslan Darawsheh , "stable@dpdk.org" Subject: RE: [PATCH v2] common/mlx5: fix the sysfs port name translation Thread-Topic: [PATCH v2] common/mlx5: fix the sysfs port name translation Thread-Index: AQHZXLJY9RXhExT0dUGkOdULiiIuGa8G5DAAgAEibcA= Date: Thu, 23 Mar 2023 08:20:21 +0000 Message-ID: References: <20221110155726.649190-1-bingz@nvidia.com> <20230322113412.685653-1-bingz@nvidia.com> <20230322075842.4547c8d1@hermes.local> In-Reply-To: <20230322075842.4547c8d1@hermes.local> Accept-Language: en-US, zh-CN Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: DM4PR12MB5184:EE_|MW6PR12MB8913:EE_ x-ms-office365-filtering-correlation-id: 28344380-88e0-4b01-4253-08db2b7771ac x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: nHPdl7mzVVbzKF8deN0WDGqG85GMimZvnKQqJjS8bwv+bKDEUsDKD5sWeJOWAPCpUcgRY+3DVI39pjEAsYwJgYTjhYnP2o4V+3NvKynIgn+dv01hpope8mkBpM+cR/htRXFbxI3sLltBP4JD0nkCb87SE51g8/W8irm/ciNUvYa7d0Z4cIHy8MP8o7ugkAPCDf4Vb181Y7jcslEshvYsvApal4rD1+I6848ISOQcp2dM8dG3W7LuPY+Frc8OvhAn+d43FGaP9mEx5lOkgTkVRyIvV6/PGDCU7aVcKx3pbatJow5yEkprLE6Gm7eGnfvpr0i0ljIxeUTvrNvhqzyP9vGISvKXEdG9gK+UaCv7sFnK30pHcTOc6vvAC+g3UOQXE7Dfe68w8HsHkNttaxyBvbwnrHOJquUwKwI6f7RQQnobkdtxWTmpwql3oAx5YP7MyzrFCbfJCSNBJk194uOpltfB8LycMyiAY8t2/HjjmILROtAd6Ou6Gl5rhSfCPXPGs+dI0pdkZ9AlYW6hzMr4/cSFakLT05RNuI7hMYJx+dk5jLFE7K8t7I33STUx5i7/65x27Ovy0ydjm3Lbzpr/XaWheOVAMHUA3Z0gtMer2vUCiaCabauCdffe17dwIS+x9OtTxG6kFMe3FojSF/tii8xNarribwAdm42zqclNdRX1ukuZ9HQl/V4Hc0HoWTt4jk190p/X6CQ7ZLGN6tFb9A== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR12MB5184.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230025)(4636009)(346002)(396003)(39860400002)(136003)(366004)(376002)(451199018)(41300700001)(66556008)(6916009)(64756008)(66446008)(8676002)(4326008)(5660300002)(2906002)(52536014)(66476007)(38070700005)(33656002)(86362001)(38100700002)(122000001)(7696005)(71200400001)(26005)(8936002)(76116006)(478600001)(316002)(66946007)(55016003)(54906003)(6506007)(83380400001)(9686003)(186003)(53546011); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?QhR0W367/47/gCuol+AQxvjPlJGiUKLaNta7+EcFnmFLLChN7w9S9ewQt4Qg?= =?us-ascii?Q?OfOGEnfSG1z1rYdOyZ97Y7dKNPUEv5XG94JQYQ2u+SdmqISASBMJUeFNyp7R?= =?us-ascii?Q?X8uSDBg1opnfo8iotKqyi+KTA6PHhQGNvvcYA4Luwx7sgrZtflkj5vB0MlpW?= =?us-ascii?Q?fvesVU6yD7jynh0R+xUSVWIH3iATEbhtAgZS2ul4je/UPatwLm4bv2pMqn9a?= =?us-ascii?Q?exMNjI98aBkmGiNCnh558zSR9DVal0xUcBUpaTIBqMe2ZqWJp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6JX6bmsbumMlIcyI5q9voVQ8KN8YhkrPL9AuHFymugIV?= =?us-ascii?Q?ICC94ffUBTEyiv6msqnVU2PfXVRYsG+NiSBuz+ktBdn9rT7czBsyvIB1/InE?= =?us-ascii?Q?qnSHb8kbpINQEs1a2yZUw3YV2hi6nKFctCheRjs1TiNYMeV2V16Q7mhxkC68?= =?us-ascii?Q?Y1aN+EaazfTXRYo8vH+urMxHxwHZzUqMYxkyA9Fb3lNQPNHFbFUWrhSmAfSp?= =?us-ascii?Q?/X/KCMaViFOc2qnDiTP4MNcHjkCHjH3j1erX6gybl9OJLJbx4KI7jdN+0Dce?= =?us-ascii?Q?OAFpWaVPNy9N40Zm6VnySrT2YYVrb5G7xm9N3j9FbP5/KggJDHZl901NC3Ki?= =?us-ascii?Q?yCmlrTAE2qMIwBBn65BANJZ3V4zrIm2hSqJxPjHrNFmyb+F7Pk/OTKWGhYgF?= =?us-ascii?Q?v/dtC4lOxKVtQpDOw7g=3D?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM4PR12MB5184.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 28344380-88e0-4b01-4253-08db2b7771ac X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Mar 2023 08:20:21.0649 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 6i24l+ojbvyZXtrPgEg+SwIshgIfrurVKr5yDcq2vHvUjHnFZt1kvDstnxRFJ1Q+cSxl2wulfFrEMHeYN6UBtg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW6PR12MB8913 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 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 Hi Stephen, > -----Original Message----- > From: Stephen Hemminger > Sent: Wednesday, March 22, 2023 10:59 PM > To: Bing Zhao > Cc: Slava Ovsiienko ; Matan Azrad > ; dev@dpdk.org; Raslan Darawsheh > ; stable@dpdk.org > Subject: Re: [PATCH v2] common/mlx5: fix the sysfs port name translation >=20 > External email: Use caution opening links or attachments >=20 >=20 > On Wed, 22 Mar 2023 13:34:12 +0200 > Bing Zhao wrote: >=20 > > + > > + port_name =3D (char *)malloc(IF_NAMESIZE); > > + if (port_name =3D=3D NULL) { > > + fclose(file); > > + rte_errno =3D ENOMEM; > > + return -rte_errno; > > + } > > + line_size =3D getline(&port_name, &port_name_size, file); >=20 > This code is doing unnecessary extra work here. > From getline() man page: Yes, I also checked the description of this interface before. The original = purpose was to allocate / free the memory explicitly. This will be removed. >=20 > If *lineptr is set to NULL before the call, then getline() will > allocate a buffer for storing the line. This buffer should be > freed by the user program even if getline() failed.