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: 10012493 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 558DF60211 for ; Tue, 17 Oct 2017 16:48:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4A0BA2899C for ; Tue, 17 Oct 2017 16:48:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3E81C2899E; Tue, 17 Oct 2017 16:48:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_WEB, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 164732899C for ; Tue, 17 Oct 2017 16:48:56 +0000 (UTC) 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" X-Virus-Scanned: ClamAV using ClamSMTP 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);