From patchwork Thu Jan 14 15:02:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anatoly Burakov X-Patchwork-Id: 86636 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id D60D0A0A02; Thu, 14 Jan 2021 16:02:49 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B5A44141354; Thu, 14 Jan 2021 16:02:49 +0100 (CET) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mails.dpdk.org (Postfix) with ESMTP id 44F7A141352; Thu, 14 Jan 2021 16:02:48 +0100 (CET) IronPort-SDR: PqB4+tIqB3MAm2tSpVKWLKUaw+kVzX4iTIHIVTX+SqQzZH41p65z8ltkZY6uVnwInE/NXZJsV4 TU3mxdzOomRw== X-IronPort-AV: E=McAfee;i="6000,8403,9864"; a="158154140" X-IronPort-AV: E=Sophos;i="5.79,347,1602572400"; d="scan'208";a="158154140" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jan 2021 07:02:47 -0800 IronPort-SDR: S+6vGlYWxihEwAktGAE9qwVBm5Hhc7nwhlMHnt95KUpvaNeQxIADZ6nlKBQ4eyCYa+JkRST5MC TZSYvZ2Jv0Tw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.79,347,1602572400"; d="scan'208";a="382293544" Received: from silpixa00399498.ir.intel.com (HELO silpixa00399498.ger.corp.intel.com) ([10.237.222.179]) by orsmga008.jf.intel.com with ESMTP; 14 Jan 2021 07:02:46 -0800 From: Anatoly Burakov To: dev@dpdk.org Cc: stable@dpdk.org Date: Thu, 14 Jan 2021 15:02:45 +0000 Message-Id: X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH] fbarray: fix incorrect overlap check 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 Sender: "dev" When we're attaching fbarrays in secondary processes, we check for whether the intended memory address for the fbarray is already in use by some other, local fbarray. However, the check for end-overlap (i.e. to see if our memory area's end overlaps with some other fbarray) is incorrectly counting end offset as part of the overlap. Fix the check. Fixes: 5b61c62cfd76 ("fbarray: add internal tailq for mapped areas") Cc: stable@dpdk.org Signed-off-by: Anatoly Burakov Tested-by: Peng, ZhihongX Signed-off-by: Anatoly Burakov Tested-by: Zhihong Peng --- lib/librte_eal/common/eal_common_fbarray.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/librte_eal/common/eal_common_fbarray.c b/lib/librte_eal/common/eal_common_fbarray.c index 1220e2bae9..d974f3dab7 100644 --- a/lib/librte_eal/common/eal_common_fbarray.c +++ b/lib/librte_eal/common/eal_common_fbarray.c @@ -110,7 +110,7 @@ overlap(const struct mem_area *ma, const void *start, size_t len) if (start >= ma_start && start < ma_end) return 1; /* end overlap? */ - if (end >= ma_start && end < ma_end) + if (end > ma_start && end < ma_end) return 1; return 0; }