From patchwork Mon Jan 6 20:55:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 64248 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id E5620A04F6; Mon, 6 Jan 2020 21:56:07 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id CFE9B1D6F9; Mon, 6 Jan 2020 21:56:06 +0100 (CET) Received: from mail-pg1-f193.google.com (mail-pg1-f193.google.com [209.85.215.193]) by dpdk.org (Postfix) with ESMTP id EFEFF1D6EE for ; Mon, 6 Jan 2020 21:56:05 +0100 (CET) Received: by mail-pg1-f193.google.com with SMTP id l24so27414417pgk.2 for ; Mon, 06 Jan 2020 12:56:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=JGYIgq+uwfpes47A1SXtgbwDNsKAt5Xi3KqQJ3KrWpM=; b=JCzs4Uz/gfQ0VvF/7sS8akRA9vXywgmVBeX1YPfDXnjtBN93zlA2zGYC9IKUZcSWXj sD7fGB0W0N1+ZOAbW+Pr7+y23a+1CVCo6NJLOUaCmAWSQUhviiZW+MvvZ6n88mUHKzCi 49uLgO10Kk70S07x+tAaKA6gRQuQES1oBPFLWjwS4KclH4I8bA48kOUSoIaIax9YKEaR 4daortkTroN7EtfkW4xZLbT/y1u1kydtgkmuq3a85uJgrULTnh3OsIb8s5ZJc2aX5Xs4 9t4VStCT/0vn6Zf+pm4ANfCqdm5022cO3LFXPSPpn6r+YSSrurJKYJWh4VLhcTXUvXXX Korg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=JGYIgq+uwfpes47A1SXtgbwDNsKAt5Xi3KqQJ3KrWpM=; b=khsCjzZJ1R+nhO1HTT1p/xyQUuw9natULI8Us91CVP/oss2npFU7Yr1I7qAbazjo4e DJ5i92x62T7W91yorU0P+RFepOnliHjIEoTyG80uOsxH709vNopI0oQFLrUUG2+gEEfS jGT9CBi5PGa9Mt4Xmv16r/4jYsAW5N6TAI9PJSpCkmbTEdQUBqWQLTueoRzDmHcoX45m hvJ8mgUYax35JC/cMLUpUbI/DsqkYXNwtLf19HYv2XEZdUehsi4HtZmw5pxeGLRESebA HiHBfm4wePi7h8wYkU4e1ksolqBEAaBdgLq3t7H7z/osJFGpEMegbUHDgsNoqNKsb6Ze f1KA== X-Gm-Message-State: APjAAAWc96/j4mHWN8MfcxT1QyA+/GJ/r383tg4p3oySiP41EElsfp0D UGV9bhtBVZMX0X5EDPK6piT/5bnjFZQ= X-Google-Smtp-Source: APXvYqzNy5V7dJA4psrSgnUpt+sAVD9CTy43ogvGMw52BI9Go5sX7KdLWyiLvy+XCTakmDE56ZrN7w== X-Received: by 2002:aa7:9484:: with SMTP id z4mr108776893pfk.88.1578344164513; Mon, 06 Jan 2020 12:56:04 -0800 (PST) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id x132sm77652555pfc.148.2020.01.06.12.56.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jan 2020 12:56:03 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , anatoly.burakov@intel.com, stable@dpdk.org Date: Mon, 6 Jan 2020 12:55:53 -0800 Message-Id: <20200106205553.3696-1-stephen@networkplumber.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH] mem: fix incorrect munmap in error unwind 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The loop to unwind existing mmaps was only unmapping the first segment. Also, remove obvious redundant assignment. Fixes: 66cc45e293ed ("mem: replace memseg with memseg lists") Cc: anatoly.burakov@intel.com Cc: stable@dpdk.org Signed-off-by: Stephen Hemminger Acked-by: Anatoly Burakov --- lib/librte_eal/linux/eal/eal_memory.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/librte_eal/linux/eal/eal_memory.c b/lib/librte_eal/linux/eal/eal_memory.c index 43e4ffc757bd..cf5b2433614b 100644 --- a/lib/librte_eal/linux/eal/eal_memory.c +++ b/lib/librte_eal/linux/eal/eal_memory.c @@ -1967,9 +1967,8 @@ eal_legacy_hugepage_attach(void) close(fd); error: /* map all segments into memory to make sure we get the addrs */ - cur_seg = 0; for (cur_seg = 0; cur_seg < i; cur_seg++) { - struct hugepage_file *hf = &hp[i]; + struct hugepage_file *hf = &hp[cur_seg]; size_t map_sz = hf->size; void *map_addr = hf->final_va;