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 7A3214280A; Wed, 22 Mar 2023 15:58:46 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6D47142B71; Wed, 22 Mar 2023 15:58:46 +0100 (CET) Received: from mail-pj1-f53.google.com (mail-pj1-f53.google.com [209.85.216.53]) by mails.dpdk.org (Postfix) with ESMTP id D0E39410EF for ; Wed, 22 Mar 2023 15:58:44 +0100 (CET) Received: by mail-pj1-f53.google.com with SMTP id q102so4262312pjq.3 for ; Wed, 22 Mar 2023 07:58:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20210112.gappssmtp.com; s=20210112; t=1679497124; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=py1P+OUUyg4ni1hTcM+LVLfPJn1ICaWBk/BjmM5keWU=; b=pfixY1+aLkD/3kiRBFhq3tO7cvDWmDtoRCPwB0zybqvuphKAVSGLm5vIi5+wbbI4C2 fP2GY2z/zIFVccZ4YFLwCC08Gld+rufmQVtTu+8TmIx9HZfHmg3zIVjvmB3UplBN00YU nRXNLUmQ5qI0bNZCYncs3qPxyMyqeJrNCSQTuUwe0Y3ydNH+KWIHkt5J40dVGgHa7goF rAd7NB1D2POladkKrppGfXrcs8pnmDBhPazUkhystBiOurljDlzIRMU6bnjb6OgDE0Zx xbFoTo0R8trGMSPCRvDO6lX5vxCpDGMF4wKhGNFWY78FG8OfedAzYGG0/0CZ/ll0Kurj ONFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679497124; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=py1P+OUUyg4ni1hTcM+LVLfPJn1ICaWBk/BjmM5keWU=; b=ifraR8OT0ue6xmMZWntclydCy+QPe8lhlqQ/CjbbczORmJZXVfTbtPjFnQ/iOSAjZg RFsWiUt+TX324rmtIn5BwQBox+2SuQXWwIonPY6cYkFSb882ePLFHia0K4wSpcMbpHXi INl5K2anwfKVizknzVqQ04nmK8Rei0+A09JOHbJ0z2IGNYPA61CCB52984k8F9Pm1AWv m9n/kCk6s0x6Gyv20cHHWbWNiorkIHlXMEQrqxPYiBRKeeOI91X575tHGZx/dHvaP8pq ZHx3tYef5L7e0/S2gXmPRsJ+MEWJXXQRU9nHHn3PWnRz4yFJmRw26EyjMJveJ2kOqIWd UBmg== X-Gm-Message-State: AAQBX9dX0sTJ2gjGiYiGj5b2RxYd/Alk+zFJt1BC6BdRaecsTvWfyz5N hUijZ6AlRA3O3g9wUWipRQLy+A== X-Google-Smtp-Source: AKy350YD++OKL+pQ0Ybv2d/Xckr9QG9Xmfinc21CcBhD6yd0Bz93SxDZhaAQvj44n2MuUrfF5LVUjw== X-Received: by 2002:a17:902:f688:b0:19e:2495:20e0 with SMTP id l8-20020a170902f68800b0019e249520e0mr2468212plg.21.1679497123989; Wed, 22 Mar 2023 07:58:43 -0700 (PDT) Received: from hermes.local (204-195-120-218.wavecable.com. [204.195.120.218]) by smtp.gmail.com with ESMTPSA id a5-20020a1709027d8500b001a1c2ee06e0sm7420443plm.15.2023.03.22.07.58.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Mar 2023 07:58:43 -0700 (PDT) Date: Wed, 22 Mar 2023 07:58:42 -0700 From: Stephen Hemminger To: Bing Zhao Cc: , , , , Subject: Re: [PATCH v2] common/mlx5: fix the sysfs port name translation Message-ID: <20230322075842.4547c8d1@hermes.local> In-Reply-To: <20230322113412.685653-1-bingz@nvidia.com> References: <20221110155726.649190-1-bingz@nvidia.com> <20230322113412.685653-1-bingz@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Wed, 22 Mar 2023 13:34:12 +0200 Bing Zhao wrote: > + > + 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); This code is doing unnecessary extra work here. =46rom getline() man page: 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.