All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] vfio: Fix overflow while assigning vfio BAR region offset and size
@ 2015-06-16 14:16 Rahul Lakkireddy
  2015-06-17 12:09 ` Thomas Monjalon
  2015-06-23 15:00 ` [PATCH v2] " Rahul Lakkireddy
  0 siblings, 2 replies; 16+ messages in thread
From: Rahul Lakkireddy @ 2015-06-16 14:16 UTC (permalink / raw)
  To: dev; +Cc: Felix Marti, Kumar Sanghvi, Nirranjan Kirubaharan

After the commit-id 90a1633b2 (eal/linux: allow to map BARs with MSI-X tables),
VFIO stopped working. On further debug, found that although BAR region
offset and size from vfio are read as u64, they are truncated when assigned to
uint32_t variables resulting in wrong offset being passed for mmap.

The fix is to use uint64_t for offset and size.

Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Signed-off-by: Kumar Sanghvi <kumaras@chelsio.com>
---
 lib/librte_eal/linuxapp/eal/eal_pci_vfio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c
index 426953a..d0385ff 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c
@@ -728,7 +728,7 @@ pci_vfio_map_resource(struct rte_pci_device *dev)
 		struct vfio_region_info reg = { .argsz = sizeof(reg) };
 		void *bar_addr;
 		struct memreg {
-			uint32_t offset, size;
+			uint64_t offset, size;
 		} memreg[2] = {};
 
 		reg.index = i;
@@ -771,7 +771,7 @@ pci_vfio_map_resource(struct rte_pci_device *dev)
 				RTE_LOG(DEBUG, EAL,
 					"Trying to map BAR %d that contains the MSI-X "
 					"table. Trying offsets: "
-					"%04x:%04x, %04x:%04x\n", i,
+					"%04lx:%04lx, %04lx:%04lx\n", i,
 					memreg[0].offset, memreg[0].size,
 					memreg[1].offset, memreg[1].size);
 			}
-- 
2.4.1

^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2015-07-14  8:57 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-16 14:16 [PATCH] vfio: Fix overflow while assigning vfio BAR region offset and size Rahul Lakkireddy
2015-06-17 12:09 ` Thomas Monjalon
2015-06-18 14:23   ` Rahul Lakkireddy
2015-06-23 15:00 ` [PATCH v2] " Rahul Lakkireddy
2015-06-30 21:12   ` Thomas Monjalon
2015-07-01  8:34     ` Alejandro Lucero
2015-07-01 10:00       ` Burakov, Anatoly
2015-07-06 15:45         ` Alejandro Lucero
2015-07-07  7:56           ` Rahul Lakkireddy
2015-07-07  9:08           ` Burakov, Anatoly
2015-07-07 10:40             ` Rahul Lakkireddy
2015-07-07 10:50               ` Burakov, Anatoly
2015-07-10  9:54                 ` Rahul Lakkireddy
2015-07-10 17:27                   ` Alejandro Lucero
2015-07-13  8:51   ` [PATCH v3] " Rahul Lakkireddy
2015-07-14  8:56     ` Thomas Monjalon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.