From patchwork Tue Sep 26 22:45:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 114297 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp4358367qgf; Tue, 26 Sep 2017 15:47:27 -0700 (PDT) X-Received: by 10.107.142.211 with SMTP id q202mr16309522iod.65.1506466047050; Tue, 26 Sep 2017 15:47:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506466047; cv=none; d=google.com; s=arc-20160816; b=hKUgItonBEsXi1D2p8pRk71Q9EWWQacbh9BL8B3iPBA3TiFR/2RyMWbwko9RWpfE4d dyAF+UaA+9jgC2t51AL8hc2lQrmvdi+lI3sXx+TMfQSUrEVh3ACWNrKgB/hmCkC6qxEd 5If7nARPSVBeEQ3K4QziH/ID4kobZMxK/uB/7IaejYVI/mq7kncwKKZbuH7kSdguChZQ 0j9FbyTDutLixUQVfjTuSbebeKw185UD9s771pPXnPdrw/wGxPAEWAhNT9kAVJFMmQkU XwztorZseHD9msQkws++2oYd8jq+wKEjfvvYU6+hc6zxKEhq9z7mJN50mpA9arRxlBkH 3p0g== 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=a8MwexMTZ7h1Q9F+Xahkkw1TjpgowZ5DWe5mfTLVUss=; b=Ra1MxWY2lWN5yJdrkdBpxjW/scRyvPVo0KNxV6cnPTuyTpzZmU/LPFX0VwmVEpWk23 /EJJadIEegU7wyIp7jBam3lrwXJnW8nlm/bydTcRTsMnP0M3X92mTCGzbxDSLlNl09hZ CexdSPBTKu2TeCGRkxn5KGnu7fbMCuI2XezrWXuztwM9HeZB0zBqu9R4WPFuGmJDP+Jc 02jvsqRkrczXJtLcygnU3DkARN1Ddrp+pGjdEFiBtvhYd5CZyrg81aH0VtS27ah/Mwnl vKdmMrT+jr3XBRHZBjMb3Qnnof+ZQfLCqcUt1hq44KUP0whuUHMWqaXyUWozHfg7fynk V9LA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=e4bb0dc4; 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 w17si3034027ite.21.2017.09.26.15.47.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Sep 2017 15:47:27 -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=e4bb0dc4; 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 1dwybG-0004Ps-Pz; Tue, 26 Sep 2017 22:45:10 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dwybF-0004Pk-JK for xen-devel@lists.xenproject.org; Tue, 26 Sep 2017 22:45:10 +0000 Received: from [85.158.143.35] by server-2.bemta-6.messagelabs.com id 41/8E-10804-478DAC95; Tue, 26 Sep 2017 22:45:08 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrDIsWRWlGSWpSXmKPExsVyMfTAKt2iG6c iDRYtErT4vmUykwOjx+EPV1gCGKNYM/OS8isSWDP2P7/JWHCbvWLe7X9sDYwb2LoYuTiEBGYw Ssy++ZkdxGERaGeWeD35DwuIIyHwjkVic9sv1i5GTiAnT+Ly6S/sEHaaxN7lu1kg7DKJZefeM oLYQgJaEkdPzWaFGLucSWLtrIVACQ4ONgETiVkdEiA1IgJKEvdWTWYCsZkFQiWm/n0ANkcYyP 726hzYHBYBVYnJb3ezgdi8At4ST5d+hbpBTuLmuU7mCYz8CxgZVjFqFKcWlaUW6Rqa6SUVZaZ nlOQmZuboGhqY6eWmFhcnpqfmJCYV6yXn525iBIYQAxDsYLy/MeAQoyQHk5Io7/e+U5FCfEn5 KZUZicUZ8UWlOanFhxhlODiUJHhfXAPKCRalpqdWpGXmAIMZJi3BwaMkwnsFJM1bXJCYW5yZD pE6xejKceHOpT9MHDceXgeSX3pvAMkDe24ByY6bd/8wCbHk5eelSonzxlwHahYAac4ozYMbDY vES4yyUsK8jEDHCvEUpBblZpagyr9iFOdgVBLmfQsyhSczrwTugldAxzEBHdc79QTIcSWJCCm pBsa+32ZbopiKH/2Y4RnX5c76tvbsD4nT3lENkscaNjw5tep7luLvNzrc6ayOPUEfdvm/Z/3f k723M6rw/gybfYk5XgrLD+g811PaIdBbdTx9nUJHwsHcIz+2Jtiu95mvzs6rVpmkvD3N6G752 2CbqSK7bIXeKb5Y/lntN8NcCYNSNk/zjeFTrZRYijMSDbWYi4oTAamLlZi/AgAA X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-3.tower-21.messagelabs.com!1506465905!81275966!1 X-Originating-IP: [209.85.192.170] 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 44495 invoked from network); 26 Sep 2017 22:45:06 -0000 Received: from mail-pf0-f170.google.com (HELO mail-pf0-f170.google.com) (209.85.192.170) by server-3.tower-21.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 26 Sep 2017 22:45:06 -0000 Received: by mail-pf0-f170.google.com with SMTP id p87so6245043pfj.9 for ; Tue, 26 Sep 2017 15:45:06 -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=f7/I0E4wWcBBaLV/nyFbhvmaNVjHZwYM8f4pALK+aBE=; b=e4bb0dc4H7hUjQM6eupY74wG2omg7cIYWDmxWZthDAsYOf+/KrQsmxs9vyv4Z4QCFx VJ/UcoYSm68B/1CGbymqnfUUiq2wg+Y/3BVe7vyivvboSphRPFKFgp8BX2xszE78ydur d/F58WTgiB7b8uyYpW2BY/ntYunA8zX7tS+j0= 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=f7/I0E4wWcBBaLV/nyFbhvmaNVjHZwYM8f4pALK+aBE=; b=NblSbcUHFqWpWyqJRx3uk/shHLEDv3Gf7MiJxKAC2iRakvZlxvU0alp62Gf13HVfi4 xNpMuBsiIuHnBqdxEjuPAHikfq9yMvk2Q096w3cLm7m3gLhbEkdaHKarBKRWbItl+whK 2r7igEksDGBJI5bnkllUYhs46WsT4u7YRD6u0XRSBEWUDXVinh+23mZS06vjNKEM+8l1 g4x0BIwMRt31QGedeV9QVzkVUpeMorNxd8dDhmtxelWTDE9rDUGSvsd14ebPZhJDSeOC vzy94L1HrxHCLHuuR69pnsAdVsykJ26hLagZSpH6/3g0v/IAwoQTrtdbtIBpa9FPkqJZ HnKQ== X-Gm-Message-State: AHPjjUj2EdR0oucrVOZPUeOvH/e10TDsXOyfVp+GgJfoDuOxytU0C0RO Yq8PI2BAcw9IPdgHBBD5UT+03ohLniA= X-Google-Smtp-Source: AOwi7QBUcICmF4suA/hrkelad9btbWik7NPT1NF5jLSZOBV8M7gout4fx/ieof6Mwu29D1BaS3mAGQ== X-Received: by 10.99.184.9 with SMTP id p9mr12069227pge.6.1506465904132; Tue, 26 Sep 2017 15:45:04 -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 z83sm16459607pfd.10.2017.09.26.15.45.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 26 Sep 2017 15:45:03 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Wed, 27 Sep 2017 04:15:01 +0530 Message-Id: <1506465901-24665-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] 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. 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;