From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: Re: [PATCH v3] vfio: Fix overflow while assigning vfio BAR region offset and size Date: Tue, 14 Jul 2015 10:56:35 +0200 Message-ID: <2812850.KVDAfLqkr9@xps13> References: <2eeeff646a329cca169033f541de3e96cec3a27a.1435067129.git.rahul.lakkireddy@chelsio.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Cc: dev@dpdk.org, Felix Marti , Nirranjan Kirubaharan , Kumar Sanghvi To: Rahul Lakkireddy Return-path: Received: from mail-wg0-f47.google.com (mail-wg0-f47.google.com [74.125.82.47]) by dpdk.org (Postfix) with ESMTP id 786BFC38A for ; Tue, 14 Jul 2015 10:57:48 +0200 (CEST) Received: by wgxm20 with SMTP id m20so3115137wgx.3 for ; Tue, 14 Jul 2015 01:57:48 -0700 (PDT) In-Reply-To: List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 2015-07-13 14:21, Rahul Lakkireddy: > When using vfio, the probe fails for BAR > 0 after the > commit-id 90a1633b2 (eal/linux: allow to map BARs with MSI-X tables). > > While debugging further, found that the BAR region offset and size read from > vfio are u64, but are assigned to uint32_t variables. This results in the u64 > value getting truncated to 0 and passing wrong offset and size to mmap for > subsequent BAR regions. > > The fix is to use unsigned long for the offset and size. > > This is based on patch by Alejandro Lucero > posted at below: > > http://dpdk.org/ml/archives/dev/2015-June/020201.html > > and updated with diff from below to fix 32-bit compilation: > > http://dpdk.org/ml/archives/dev/2015-July/020963.html > > Fixes: 90a1633b2347 ("eal/linux: allow to map BARs with MSI-X tables") > Signed-off-by: Rahul Lakkireddy > Signed-off-by: Kumar Sanghvi Applied, thanks