From patchwork Wed Oct 25 09:27:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 10026199 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 DEDFC60375 for ; Wed, 25 Oct 2017 09:29:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C39C5269B2 for ; Wed, 25 Oct 2017 09:29:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B8BA626E1A; Wed, 25 Oct 2017 09:29:44 +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=-0.7 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_BL_SPAMCOP_NET, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_SPAM, RCVD_IN_SORBS_WEB, T_DKIM_INVALID autolearn=no 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 76235251F9 for ; Wed, 25 Oct 2017 09:29:44 +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 1e7HyC-0003fN-18; Wed, 25 Oct 2017 09:27:28 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e7HyA-0003ex-CS for xen-devel@lists.xenproject.org; Wed, 25 Oct 2017 09:27:26 +0000 Received: from [85.158.137.68] by server-8.bemta-3.messagelabs.com id B5/27-00983-DF850F95; Wed, 25 Oct 2017 09:27:25 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrCIsWRWlGSWpSXmKPExsVyMfTAQd2fER8 iDf4sNrP4vmUykwOjx+EPV1gCGKNYM/OS8isSWDMWzv3MWvBUsOLwg8VsDYwXeLsYuTiEBGYx SnzpuscI4rAIzGOWuPprLyuIIyHQzyoxb89Zti5GTiAnT+L66j2sEHaaxMV5m1gg7HKJ+XPaG UFsIQEtiaOnZrNCjG1hkujftY+pi5GDg03ARGJWhwRIjYiAksS9VZOZQGqYBeYzSjRN6gVbIC yQJPHi8CMwm0VAVWLCrHlgC3gFvCW2zmphglgmJ3HzXCcziM0p4CPx6eZkJojF3hJXvi1gnMA ouICRYRWjenFqUVlqka6xXlJRZnpGSW5iZo6uoYGxXm5qcXFiempOYlKxXnJ+7iZGYMgxAMEO xuYvTocYJTmYlER5wz0+RArxJeWnVGYkFmfEF5XmpBYfYpTh4FCS4I0DhrCQYFFqempFWmYOM Phh0hIcPEoivEkgad7igsTc4sx0iNQpRleOC3cu/WHiOLbpMpA8sOcWkOy4eRdIPpv5uoFZiC UvPy9VSpxXC6RZAKQ5ozQPbjQsci8xykoJ8zICHSvEU5BalJtZgir/ilGcg1FJmLcYZApPZl4 J3AWvgI5jAjquSRXsuJJEhJRUA2OryMIs7nunTD4Hqdt4ylvcOdu6j09k2lvnpUfs+G8GN03f pXByHuuHm20mp1bvSLvz59Wn1lvNJy7kK90UtWSM9lvfV+cgk6W27vj8/7d1bZxPe8Y4lJW2m vaWHH3v8/T2jKAlWzXzHCV0JimVTXQ5uvf4PQtGiwNBkqtSJ3xsTNluteiDl58SS3FGoqEWc1 FxIgDhB/8J1wIAAA== X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-7.tower-31.messagelabs.com!1508923640!104322829!1 X-Originating-IP: [209.85.192.193] 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 55918 invoked from network); 25 Oct 2017 09:27:21 -0000 Received: from mail-pf0-f193.google.com (HELO mail-pf0-f193.google.com) (209.85.192.193) by server-7.tower-31.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 25 Oct 2017 09:27:21 -0000 Received: by mail-pf0-f193.google.com with SMTP id b85so21779033pfj.13 for ; Wed, 25 Oct 2017 02:27:21 -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=MbJnOrhSN4dms97WXwW1NxXA95YIfRoF4gRBCjPvfjU=; b=OZDrRHbz4lpJNidquOJ83R61IIpNJtNRVfephuMmcCrrrez6UJ1pzxLJ0/rMaFt+Ow LtX6FB5fLuUKqBs24h8pC9mo0bR4EKBS0+i+tc4Pl0yn3GBuYdgwTnbH8D0Ga/NPArfn aoEK1v4LKDACfZ8+UmRcGpudCSXyzXfpw1uBk= 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=MbJnOrhSN4dms97WXwW1NxXA95YIfRoF4gRBCjPvfjU=; b=oVw10aXR3o6Fqs1t6U9zde21qPYiuvo/frC8Eu7WY1Xxxnj5CgQDJhRq+PmkDqosEi q3AsBi6IGPEKj1lW3j28XT14RDqBPejJIPCyPbACMY9cxZyRb7I/LVWW4AQ/ahRDXXeJ Sz2fXtSRJPNU/YHp+ZL2AE9kgw0miMSTpqSVTTb7MZ9NjKVT6nqcRG2wEvPshn5eJZvY fumYxzwTCZbIY2b23J68wKE5lpVJciZmp+6iXWCr+2Gscn8zclnbCruR5ihhDq8+KTsf oSIXvxxTrXxlgOrg0mVW8mN5wbxylFZDYVa793wEx9W8Id0Mxr3D9DmeE/asO+sUwzEa vQjA== X-Gm-Message-State: AMCzsaXA6ynngrzriedBG6TNKCHizQriTka5y2sNiMn9MHiMT2BDkqRd o2u2FfRYIqUVlEJpnSPsmykJhr4ILeY= X-Google-Smtp-Source: ABhQp+SbRiDZX/f5FdwZxShs34VweX6TxYQWt8X30gCZMvxBsEqx/lQlQOlrXJHWdWzoxBIP988CqA== X-Received: by 10.98.21.86 with SMTP id 83mr1608167pfv.290.1508923640186; Wed, 25 Oct 2017 02:27:20 -0700 (PDT) Received: from blr-ubuntu-linaro.wlan.qualcomm.com ([103.5.19.18]) by smtp.gmail.com with ESMTPSA id m17sm4022861pfh.28.2017.10.25.02.27.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 25 Oct 2017 02:27:19 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Wed, 25 Oct 2017 14:57:06 +0530 Message-Id: <1508923628-26446-3-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1508923628-26446-1-git-send-email-bhupinder.thakur@linaro.org> References: <1508923628-26446-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 3/5 v2] 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 parameter 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 Acked-by: Wei Liu --- CC: Ian Jackson CC: Wei Liu CC: Stefano Stabellini CC: Julien Grall This patch is as per the review of commit fa1f157 libxl: Fix the bug introduced in commit "libxl: use correct type 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);