From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C09CEC2BBD4 for ; Fri, 18 Dec 2020 06:25:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7597623A82 for ; Fri, 18 Dec 2020 06:25:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732796AbgLRGZR (ORCPT ); Fri, 18 Dec 2020 01:25:17 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:9228 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726045AbgLRGZQ (ORCPT ); Fri, 18 Dec 2020 01:25:16 -0500 Received: from DGGEMS406-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4CxzMg68jMzkrL7; Fri, 18 Dec 2020 14:23:43 +0800 (CST) Received: from localhost (10.174.184.155) by DGGEMS406-HUB.china.huawei.com (10.3.19.206) with Microsoft SMTP Server id 14.3.498.0; Fri, 18 Dec 2020 14:24:27 +0800 From: Jiahui Cen To: CC: Wei Xu , Arnd Bergmann , John Garry , Bjorn Helgaas , Andy Shevchenko , , Jiahui Cen Subject: [PATCH] lib/logic_pio: Fix overlap check for pio registery Date: Fri, 18 Dec 2020 14:23:35 +0800 Message-ID: <20201218062335.5320-1-cenjiahui@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.174.184.155] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Since the [start, end) is a half-open interval, a range with the end equal to the start of another range should not be considered as overlapped. Signed-off-by: Jiahui Cen --- lib/logic_pio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/logic_pio.c b/lib/logic_pio.c index f32fe481b492..445d611f1dc1 100644 --- a/lib/logic_pio.c +++ b/lib/logic_pio.c @@ -57,7 +57,7 @@ int logic_pio_register_range(struct logic_pio_hwaddr *new_range) new_range->flags == LOGIC_PIO_CPU_MMIO) { /* for MMIO ranges we need to check for overlap */ if (start >= range->hw_start + range->size || - end < range->hw_start) { + end <= range->hw_start) { mmio_end = range->io_start + range->size; } else { ret = -EFAULT; -- 2.28.0