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 481794280A for ; 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 41811410EF; Wed, 22 Mar 2023 15:58:46 +0100 (CET) Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) by mails.dpdk.org (Postfix) with ESMTP id CEFB640A84 for ; Wed, 22 Mar 2023 15:58:44 +0100 (CET) Received: by mail-pl1-f179.google.com with SMTP id kq3so7126712plb.13 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=InzITvkmGW7xID0fspeSPoTFfuSsTcTdjb0jgRda/mUMorBuiYVi2/s+GxNOXqw5af WEeAK2HCoUwCq5NrMDHssUx6aPi3D2SRcNm2wJvl3rxem9bPEPwg5BGzaArIEMG4qVmT w5I32Xuz2uAvAT8gl2YKPRGOSxejvS8/k29LbcUMhc63jQHAik8l51+BuhA2ABTX7x7C NmH+9ub4JMFa4fbc2j5zRgpPUZZN+MMgpz7fZrSWeyb5jesR1IkBjnJr7soOYoIclpXC xUpoxxBt9BesntJk2UN6UNOc6AKyw4xB1xgiDSQDIYSH7hdzcM4mGOEr9XMvGArYlXMo k9KA== X-Gm-Message-State: AAQBX9c90/umyb9PMCqEP9ajYASmCKjcYfi2oD06WkI+NUHMJWkOp/aL QWU+r5z4BcFl1ipTspW1epmvwQ== 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: 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 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.