From patchwork Tue Oct 17 16:46:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 116145 Delivered-To: patch@linaro.org Received: by 10.80.163.170 with SMTP id s39csp1438394edb; Tue, 17 Oct 2017 09:48:37 -0700 (PDT) X-Received: by 10.107.29.138 with SMTP id d132mr6292829iod.201.1508258917077; Tue, 17 Oct 2017 09:48:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508258917; cv=none; d=google.com; s=arc-20160816; b=wlarkOQrOjPYXevzrGJii/R+mNyl8DBaBbcZanEsW1+zeYfmPV2ep+C2YBRxvqgbku mS5Kle4veWTiTQveakKlswrjCRfsxbgRBJQFjQNhhYSDFT+DYInvEGbW0KR6if4ghZHO RQ+l9kwITKnAYaDaUw1M718xfnWsKGd9A0cV4hpDAm+yLLRhifMGuN5YScEEcDRQuJpX wKjQJe8bTzxT1KDPlkGR2fd2AJzAHfaDCaA/dLYL6HoxCiAA4goGnC+hmmFFm4RG8ujI aMgWLX+1vxd2TurL03sqd5xDqsEjgpWo7LCzzMq+aFjSD7WpTPzjkffsGSl6RCePOiP7 Qe+A== 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:references:in-reply-to:message-id:date:to :from:dkim-signature:arc-authentication-results; bh=2tSZcB4nOigDMlYC6wIpx9luJ6oIZ772J0wWFT7TJ5I=; b=bZAmJjJPSvEbDz1TFI/JwV9/yIA4ykk2bjKrcktfSoZPYa7N9+Nu9w/slPBQ8aM6h1 wNT0uDO6oS4jneAG91IV3OV5AyZEvyjpTKCKqEfOyVNAaid7ZT8X9A38i3XYA1QBUUPh c7bp2A86v0UJa2NhDtcvoCvetcB3i54BOdfkD/iLCtQ/lyRX82Wh90eQgcoccbq3rdHp 5YEOhStvG2MHZS5mmsJz0tSt2c3i52W880fNx9jN54uyLyeoTGEZ1s0kC+oEf2dm4OcE v8euzysNo0FK/+wwBBTH4eo9xFVFjoRDJtqCXymYG7n0myEhVBECj6MarQkj40Av+BlG APFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=TyZSz0VU; 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 r22si7357253itc.118.2017.10.17.09.48.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 17 Oct 2017 09:48:37 -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=TyZSz0VU; 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 1e4V13-0001nR-LA; Tue, 17 Oct 2017 16:46:53 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e4V12-0001mm-Fs for xen-devel@lists.xenproject.org; Tue, 17 Oct 2017 16:46:52 +0000 Received: from [193.109.254.147] by server-6.bemta-6.messagelabs.com id 5B/C6-08608-BF336E95; Tue, 17 Oct 2017 16:46:51 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrOIsWRWlGSWpSXmKPExsXiVRuspfvb+Fm kwfNHnBbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8ajAydZCt4IVNyc2cLawPiRp4uRi0NIYAaj xJYDV1hBHBaBecwSJ5s7GEEcCYF+Vok7v6exdTFyAjl5EkfWv2DvYuQAstMkfjQHQISrJGYd3 cgIYgsJaEkcPTWbFWJqC5PEo4mPmUDq2QRMJGZ1SIDUiAgoSdxbNZkJpIZZYD6jRNOkXrD5wg LBElOfPQSzWQRUJX69f8AOYvMKeEk0fPwHdYOcxM1zncwgNqeAt8TzN5PA5gsB1czarTeBUXA BI8MqRo3i1KKy1CJdI0O9pKLM9IyS3MTMHF1DAzO93NTi4sT01JzEpGK95PzcTYzAgGMAgh2M f5YFHGKU5GBSEuV1NnwSKcSXlJ9SmZFYnBFfVJqTWnyIUYaDQ0mClxMYwEKCRanpqRVpmTnA0 IdJS3DwKInwLjMCSvMWFyTmFmemQ6ROMVpyHNt0+Q8Tx749t4Bkx827f5iEWPLy81KlxHkZQe YJgDRklObBjYPF5yVGWSlhXkagA4V4ClKLcjNLUOVfMYpzMCoJ8xqCTOHJzCuB2/oK6CAmoIP WOT0BOagkESEl1cCo8OS9i2Zr4pdg/vvfJW+d1WJ5VOPwSMc5+9rPL28fFaT3vJ7x4sbCh7Oj D4QI+GtN+5Ex8zKrTo2cd7Ol5lO+CbN/7J2gXbY9ybB25aGPTn5vEx6fenDw8K5g3uyZ6/63C 925uG3rxG9zZFIlQ5bm623W3602f5+xas62hEUh7zbuf/mm4t76+0osxRmJhlrMRcWJAKQiWj DKAgAA X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-8.tower-27.messagelabs.com!1508258810!101830847!1 X-Originating-IP: [74.125.83.42] 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 16882 invoked from network); 17 Oct 2017 16:46:51 -0000 Received: from mail-pg0-f42.google.com (HELO mail-pg0-f42.google.com) (74.125.83.42) by server-8.tower-27.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 17 Oct 2017 16:46:51 -0000 Received: by mail-pg0-f42.google.com with SMTP id m18so1853144pgd.13 for ; Tue, 17 Oct 2017 09:46:50 -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:in-reply-to:references; bh=R+Fa5d/QxowyC844ah1Vg1zmh4pIw2J8fUhqf1H/NVA=; b=TyZSz0VU5hLG8Arg8Vi6IFt325zCFhBSw3Bu6D9HL/rr/pr/4ZBIiHCB+4u2C90qgT ERU7tdMnvtxxkvK2pA4076O8C1hvXJ/HPuMnTEMvziIPm7X8JlgtLZyQ+4/EmWbcS7Rs 7Qg+m0ZUv8ZVJEnFYPophlm3ME4/Y3ElwQlzA= 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:in-reply-to :references; bh=R+Fa5d/QxowyC844ah1Vg1zmh4pIw2J8fUhqf1H/NVA=; b=VCHMU3xCpQTXvoio/SC2cY7LPiu9KgFEM5/qNT1bzH6fZMp13z//fiphux2jYe6lIr 0hw73rfhxKxc/XCEgIhheJeTrOGGTtRIegioC97HH+xwRHmLFwhg4U4XdvGnMJmr05ix BqooszokGG9L4ipcUy2Tgs08NTW3HUDZ+4svP2nP6w8L2onhmAV7Kq+mYSgCT+sJC62r i89TDxEuAKKqW1ZDJsOFbueL0Ca5nKFrFDbpp+ZKl10fd2+ee4WnxR58fHrPJ3W6OJJz b+OmsTiwCpSOT1Oa0qaWtt/eCuO5N3F1LKwrNCBFVyQmZEKiicb/JN7SJq2gIupg7H7c 3Lkg== X-Gm-Message-State: AMCzsaUTLpa4/tob8Wols7Sa7W9PuOrb74w/O6+Gb9nqDrSwDVV7fdGk MdO9qJLR4I1ucFqHcWV40qXbBczOx+A= X-Google-Smtp-Source: ABhQp+TOsQZ6onZT5g+rJrZk6L453SnR6K/QwP8rwLkIc1LVtraHA2iiA578t3Me4Jqqi3devin2aA== X-Received: by 10.159.254.13 with SMTP id r13mr1863757pls.267.1508258809410; Tue, 17 Oct 2017 09:46:49 -0700 (PDT) Received: from blr-ubuntu-linaro.wlan.qualcomm.com ([103.5.19.18]) by smtp.gmail.com with ESMTPSA id b3sm17926225pgr.81.2017.10.17.09.46.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 17 Oct 2017 09:46:48 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Tue, 17 Oct 2017 22:16:32 +0530 Message-Id: <1508258793-5690-4-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1508258793-5690-1-git-send-email-bhupinder.thakur@linaro.org> References: <1508258793-5690-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] libxc: Fix the data type of mfn parameter passed to xc_map_foreign_range() 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" Currently the data type of mfn paramter passed to xc_map_foreign_range() is unsigned long. This could be problem for 32-bit arm architectures where the lengh of long is 32 bits while mfn happens to be a 64-bit value. To avoid truncating a 64-bit value, the type of mfn is changed from "unsigned long" to xen_pfn_t. Also the parameter name "mfn" is changed to "pfn" which is a more accurate indication of what this parameter represents. Signed-off-by: Bhupinder Thakur --- CC: Ian Jackson CC: Wei Liu CC: Stefano Stabellini CC: Julien Grall tools/libxc/include/xenctrl_compat.h | 2 +- tools/libxc/xc_foreign_memory.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/libxc/include/xenctrl_compat.h b/tools/libxc/include/xenctrl_compat.h index a655e47..5ee72bf 100644 --- a/tools/libxc/include/xenctrl_compat.h +++ b/tools/libxc/include/xenctrl_compat.h @@ -26,7 +26,7 @@ */ void *xc_map_foreign_range(xc_interface *xch, uint32_t dom, int size, int prot, - unsigned long mfn ); + xen_pfn_t pfn); void *xc_map_foreign_pages(xc_interface *xch, uint32_t dom, int prot, const xen_pfn_t *arr, int num ); diff --git a/tools/libxc/xc_foreign_memory.c b/tools/libxc/xc_foreign_memory.c index 4053d26..c1f114a 100644 --- a/tools/libxc/xc_foreign_memory.c +++ b/tools/libxc/xc_foreign_memory.c @@ -33,7 +33,7 @@ void *xc_map_foreign_pages(xc_interface *xch, uint32_t dom, int prot, void *xc_map_foreign_range(xc_interface *xch, uint32_t dom, int size, int prot, - unsigned long mfn) + xen_pfn_t pfn) { xen_pfn_t *arr; int num; @@ -46,7 +46,7 @@ void *xc_map_foreign_range(xc_interface *xch, return NULL; for ( i = 0; i < num; i++ ) - arr[i] = mfn + i; + arr[i] = pfn + i; ret = xc_map_foreign_pages(xch, dom, prot, arr, num); free(arr);