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=-15.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 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 B08BAC4361B for ; Fri, 18 Dec 2020 10:41:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6A73A23A62 for ; Fri, 18 Dec 2020 10:41:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389093AbgLRKlk (ORCPT ); Fri, 18 Dec 2020 05:41:40 -0500 Received: from frasgout.his.huawei.com ([185.176.79.56]:2269 "EHLO frasgout.his.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733146AbgLRKlk (ORCPT ); Fri, 18 Dec 2020 05:41:40 -0500 Received: from fraeml706-chm.china.huawei.com (unknown [172.18.147.200]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4Cy5073Fhyz67Q9x; Fri, 18 Dec 2020 18:37:11 +0800 (CST) Received: from lhreml724-chm.china.huawei.com (10.201.108.75) by fraeml706-chm.china.huawei.com (10.206.15.55) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2106.2; Fri, 18 Dec 2020 11:40:58 +0100 Received: from [10.210.168.198] (10.210.168.198) by lhreml724-chm.china.huawei.com (10.201.108.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Fri, 18 Dec 2020 10:40:57 +0000 Subject: Re: [PATCH] lib/logic_pio: Fix overlap check for pio registery To: Jiahui Cen , CC: Wei Xu , Arnd Bergmann , "Bjorn Helgaas" , Andy Shevchenko , References: <20201218062335.5320-1-cenjiahui@huawei.com> From: John Garry Message-ID: <2cde14cd-91da-aae4-70aa-656d629259e6@huawei.com> Date: Fri, 18 Dec 2020 10:40:13 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.1.2 MIME-Version: 1.0 In-Reply-To: <20201218062335.5320-1-cenjiahui@huawei.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.210.168.198] X-ClientProxiedBy: lhreml744-chm.china.huawei.com (10.201.108.194) To lhreml724-chm.china.huawei.com (10.201.108.75) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 18/12/2020 06:23, Jiahui Cen wrote: > 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) { It looks like your change is correct, but should not really have an impact in practice since: a: BIOSes generally list ascending IO port CPU addresses b. there is space between IO port CPU address regions Have you seen a problem here? Thanks, John