From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 25E142BB8 for ; Wed, 25 Apr 2018 10:53:17 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Apr 2018 01:53:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,325,1520924400"; d="scan'208";a="36885174" Received: from aburakov-mobl.ger.corp.intel.com (HELO [10.237.220.109]) ([10.237.220.109]) by orsmga006.jf.intel.com with ESMTP; 25 Apr 2018 01:53:15 -0700 To: "Tan, Jianfeng" , dev@dpdk.org Cc: thomas@monjalon.net References: <19c4033ae0d07a666f8142c8dd06b9ac0eb45af3.1523977960.git.anatoly.burakov@intel.com> <7d1afc66-f8ce-44c8-7518-7cb641d9aac9@intel.com> From: "Burakov, Anatoly" Message-ID: <213a4fe8-463e-adf5-bf81-44c00abd1697@intel.com> Date: Wed, 25 Apr 2018 09:53:15 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <7d1afc66-f8ce-44c8-7518-7cb641d9aac9@intel.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [dpdk-dev] [PATCH 2/2] eal: fix not checking unlock result X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Apr 2018 08:53:18 -0000 On 25-Apr-18 8:09 AM, Tan, Jianfeng wrote: > > > On 4/17/2018 11:42 PM, Anatoly Burakov wrote: >> Coverity issue: 272607 >> >> Fixes: 66cc45e293ed ("mem: replace memseg with memseg lists") >> Cc: anatoly.burakov@intel.com >> >> Signed-off-by: Anatoly Burakov >> --- >>   lib/librte_eal/linuxapp/eal/eal_hugepage_info.c | 7 +++++-- >>   1 file changed, 5 insertions(+), 2 deletions(-) >> >> diff --git a/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c >> b/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c >> index 009f963..01fee51 100644 >> --- a/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c >> +++ b/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c >> @@ -304,8 +304,11 @@ clear_hugedir(const char * hugedir) >>           /* if lock succeeds, unlock and remove the file */ >>           if (lck_result != -1) { >>               lck.l_type = F_UNLCK; >> -            fcntl(fd, F_SETLK, &lck); >> -            unlinkat(dir_fd, dirent->d_name, 0); >> +            if (fcntl(fd, F_SETLK, &lck) < 0) >> +                RTE_LOG(ERR, EAL, "Couldn't unlock %s: %s\n", >> +                    dirent->d_name, strerror(errno)); > > It seems that we shall return error if this nearly-impossible error > happens, no? I'm not sure if we should. In any case, lock will be dropped by close(), so the proper fix would've been just remove the fcntl() call altogether. I'll respin. > >> +            else >> +                unlinkat(dir_fd, dirent->d_name, 0); >>           } >>           close (fd); >>           dirent = readdir(dir); > > -- Thanks, Anatoly