From patchwork Fri Sep 29 00:33:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 114466 Delivered-To: patch@linaro.org Received: by 10.140.104.133 with SMTP id a5csp195708qgf; Thu, 28 Sep 2017 17:35:42 -0700 (PDT) X-Received: by 10.36.165.70 with SMTP id w6mr4725327iti.40.1506645342799; Thu, 28 Sep 2017 17:35:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506645342; cv=none; d=google.com; s=arc-20160816; b=dFQX9y8J6Q1g7VP3tu7/W5ou6cVJ1yJrc+csRWCiiKBIO+ncv56eJO+/576TTM2WKk dtQ3MG0czjC6mut/DykmXEW0YCiP9GGd/Kc0kgXbp6zT+OAQsukUr3Gtlk6L1224onLc pwIMwaGutYUNSppREtOpQL0o1F6dJ4RqueAylV/SZEC/7v28XjBos3tYN7VUgau46R2+ UFgC+H+FH5l/Z7XUkVEpQ2Pqkryl+XH5Xj//0FxwOvO1BsKo5BhPoejyeRdeWF4C0pOO pvOGAjnsUyK8GrL55A/9N/EM56UjgM49N9tRxT2WyjWhc7vK82kVqWz/lUPbHpMg/XtZ +RYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:message-id:date:to:from:dkim-signature :arc-authentication-results; bh=bTkSv+J3CJsnW0Oi/77GStkIct1EH/R9jrIbLf20UlQ=; b=CW6fd9cat+Epy7GggU/GRzOjdtWpl9n7lOEQo9FKufK3EfL3hshfkxFrUYw5XaBYVL wJOWbdW/FrtWJwIrYPiaS9I4bqIMFUI7IqV93unJQcHnP//v5PSk1wnZjq5VrpisPfSW aDk8M6mocM3tRSkmKIh7ZoSNIoIrwxk/Ssq0hMUN4jxEIoeZKl+aqC74i1JSAo+Ck4Ca jBdzS3OWhCs0dY7IeBdvyIn5KeRBAIKveITGueMN2YfR+Iod+LtrLJRbRyC73Ka2toB4 br0loWLv7JmISwMGIc6cMzHScd8Ita3gkJbHodtfArkNlcwrgzHVh/6lWkdmLzENx00o TKZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=PGZUdRpH; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id y18si2659387ioi.306.2017.09.28.17.35.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Sep 2017 17:35:42 -0700 (PDT) Received-SPF: neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) client-ip=192.237.175.120; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=PGZUdRpH; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dxjFF-00032l-Hh; Fri, 29 Sep 2017 00:33:33 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dxjFD-00032U-Pw for xen-devel@lists.xenproject.org; Fri, 29 Sep 2017 00:33:31 +0000 Received: from [85.158.137.68] by server-9.bemta-3.messagelabs.com id 2D/0F-02044-AD49DC95; Fri, 29 Sep 2017 00:33:30 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprHIsWRWlGSWpSXmKPExsXiVRusp3t9ytl IgxcbLC2+b5nM5MDocfjDFZYAxijWzLyk/IoE1oyL764zFVzirLg+awt7A+Nv9i5GLg4hgRmM Eg823GMCcVgE2pklli79xALiSAi8Y5GY92AecxcjJ5CTJ7GxYQsLhJ0msauxixXCLpPo6Z4DV iMkoCVx9NRsVgh7KZPEi9VVXYwcHGwCJhKzOiRAwiICShL3Vk1mArGZBUIlpv59ADZSWCBC4s Pqz4wg5SwCqhKnjjqDhHkFvCRWT3oPdYGcxM1zncwTGPkXMDKsYtQoTi0qSy3SNTTWSyrKTM8 oyU3MzNE1NDDWy00tLk5MT81JTCrWS87P3cQIDB8GINjBuG275yFGSQ4mJVFe20lnI4X4kvJT KjMSizPii0pzUosPMcpwcChJ8OoAw1FIsCg1PbUiLTMHGMgwaQkOHiUR3tTJQGne4oLE3OLMd IjUKUZLji+9N/4wcezbcwtIdty8+4dJiCUvPy9VSpx3DUiDAEhDRmke3DhYtF1ilJUS5mUEOl CIpyC1KDezBFX+FaM4B6OSMC8vyFU8mXklcFtfAR3EBHTQ5IlnQA4qSURISTUwGkmkFFxavfZ JuKaW+6JFr6L6Jr/vEkw8luowZVO+7RcOtWWu1rs9/Y5v27JyL7uCd6XposBGzZyfGRoTKkvv JC4pcJXXX2oiHKr/s7pmvau9oPp9tS0mHY+YNm05O7NIsF2Moyg8YN6knjvH1bjmPc2z2XRlv pSuyDd3dVOd3Ylm5zbneN5XYinOSDTUYi4qTgQAh/MkT7ECAAA= X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-11.tower-31.messagelabs.com!1506645206!86111576!1 X-Originating-IP: [74.125.83.46] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 1700 invoked from network); 29 Sep 2017 00:33:27 -0000 Received: from mail-pg0-f46.google.com (HELO mail-pg0-f46.google.com) (74.125.83.46) by server-11.tower-31.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 29 Sep 2017 00:33:27 -0000 Received: by mail-pg0-f46.google.com with SMTP id j70so1813396pgc.10 for ; Thu, 28 Sep 2017 17:33:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=LxhXlj9Bf5g8O7ecJQVklkYND9tGCc7cnb6Fh5W5MMs=; b=PGZUdRpHdWKKWxmQDEer/hMw4ejg+VrjY1Dql2OFknUNHs8Pz7R4JE6LQq7gi4Etkk aslwq1YPwvSUnu1fWmuXTPWHdNtbCp0IPwnuBwqLNw62u2vGaEn7UcJ6dUI9FTj8x5/s aZo3oYJtdQIxPhePm9YqB88e06Htcs1ZKnj/o= 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; bh=LxhXlj9Bf5g8O7ecJQVklkYND9tGCc7cnb6Fh5W5MMs=; b=gsd3CfjLaaG0WuJOyDOY2Vt4q/OAN8ohiwap2Gap2l+BOWsOq/HjOhOZZgmsAZEvlb O/9eShBGpkhECq+mVH3hPsDSBdMqA89lGjPDRDfNZKNAqR8Kqxn+Jzdv1MafcIW/gC8Q uhjnsNG215DZbuSvNXM+AgMD/JA5OLlxHtX8GxoW8bqkVDnoeLoUK9f9FVSpe+1wEe0G QokrUTlo+D4TulEV54GyReYs406UuF08gVtS39aMrfpUiXmjzqFR2bSwD8QaICVpTaqR Kg5q7wM811Cpra5i1VEq7hmHrKu3ShhvFilxf/51M9R15ZWBjCvFMbi8QaxI7h/GsbO+ 0k5A== X-Gm-Message-State: AHPjjUgBWxfHyy0nfQL/icRJb+jbSoQ649GANl825fZtLLplyf3xAqSl h1YlwdGXlHwv1xvBQM/K4m77c3yIlzE= X-Google-Smtp-Source: AOwi7QAbmcTZCd/I8sKt+967xwBCZKBpfNcny6iiI9MmnV+NLkpPfGKnaBEDcZDzmReAx5xKObk0tA== X-Received: by 10.101.80.1 with SMTP id f1mr5641661pgo.80.1506645205908; Thu, 28 Sep 2017 17:33:25 -0700 (PDT) Received: from blr-ubuntu-linaro.wlan.qualcomm.com (h3.248.139.40.ip.windstream.net. [40.139.248.3]) by smtp.gmail.com with ESMTPSA id p12sm4484482pgd.0.2017.09.28.17.33.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 28 Sep 2017 17:33:25 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Fri, 29 Sep 2017 06:03:26 +0530 Message-Id: <1506645206-7184-1-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 Cc: Julien Grall , Stefano Stabellini Subject: [Xen-devel] [PATCH v2] xen/arm: Fix the issue in cmp_mmio_handler used in find_mmio_handler X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" This function returns true/false based on whether the key value is in the range (start, start+size). However, it should check against (start, start+size-1) because start+size falls outside the range. This resulted in returning a wrong mmio_handler for a given mmio address which happened to be start+size. This bug was introduced when the mmio region search was switched from linear search to binary search in the following commit: 8047e09 "xen/arm: io: Use binary search for mmio handler lookup". This change may have to be back-ported to 4.8 also. Signed-off-by: Bhupinder Thakur --- CC: Stefano Stabellini CC: Julien Grall xen/arch/arm/io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/arch/arm/io.c b/xen/arch/arm/io.c index e216128..c748d8f 100644 --- a/xen/arch/arm/io.c +++ b/xen/arch/arm/io.c @@ -79,7 +79,7 @@ static int cmp_mmio_handler(const void *key, const void *elem) if ( handler0->addr < handler1->addr ) return -1; - if ( handler0->addr > (handler1->addr + handler1->size) ) + if ( handler0->addr >= (handler1->addr + handler1->size) ) return 1; return 0;