From: Anatoly Burakov Date: Wed, 25 Apr 2018 10:08:13 +0000 (+0100) Subject: eal/linux: remove useless unlock of hugepage when clearing X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=4754ceaa09f4b77facde941a9a35414d0cd732bb;p=dpdk.git eal/linux: remove useless unlock of hugepage when clearing Coverity was complaining about not checking result of call to fcntl() for unlocking the file. Disregarding the fact that error value returned from fcntl() unlock call is highly unlikely in the first place, we are subsequently calling close() on that same fd, which will drop the lock, which makes call to fcntl() unnecessary. Fix this by removing a call to fcntl() altogether. Coverity issue: 272607 Fixes: 66cc45e293ed ("mem: replace memseg with memseg lists") Signed-off-by: Anatoly Burakov --- diff --git a/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c b/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c index db5aabdf8d..485a89e12d 100644 --- a/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c +++ b/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c @@ -304,11 +304,8 @@ clear_hugedir(const char * hugedir) lck_result = fcntl(fd, F_SETLK, &lck); /* if lock succeeds, unlock and remove the file */ - if (lck_result != -1) { - lck.l_type = F_UNLCK; - fcntl(fd, F_SETLK, &lck); + if (lck_result != -1) unlinkat(dir_fd, dirent->d_name, 0); - } close (fd); dirent = readdir(dir); }