Hi,

On 23/8/20 8:47 pm, Joan Lledó wrote:
> http://git.savannah.gnu.org/cgit/hurd/hurd.git/log/?h=jlledom-pciaccess-map

Thanks for doing this, I tried it locally and fixed two bugs in my libpciaccess 
patches:

diff --git a/src/x86_pci.c b/src/x86_pci.c
index 1614729..1e70f35 100644
--- a/src/x86_pci.c
+++ b/src/x86_pci.c
@@ -275,6 +275,7 @@ map_dev_mem(void **dest, size_t mem_offset, size_t 
mem_size, int write)
        return errno;
     }
 
+    close(memfd);
     return 0;
 #endif
 }
@@ -505,7 +506,7 @@ pci_nfuncs(struct pci_device *dev, uint8_t *nfuncs)
 static error_t
 pci_device_x86_read_rom(struct pci_device *dev, void *buffer)
 {
-    void *bios;
+    void *bios = NULL;
     struct pci_device_private *d = (struct pci_device_private *)dev;
 
     int err;


> Also in map_dev_mem(), it seems to be some problem when mapping the rom.
> I tried to read the rom with hexdump:
> 
> hexdump -Cn 16 /servers/bus/pci/0000/00/03/0/rom

This command now works (every time).

> In pci_device_x86_read_rom() the memory is mapped and unmapped for each
> read. I wonder if it's correct to unmap with munmap() something mapped
> with vm_map()

I think it's okay to munmap memory mapped with vm_map
but I forgot to initialise the rom memory pointer to NULL.

See http://git.zammit.org/libpciaccess.git/log/?h=rumpdisk-upstream again for 
updated branch.
If you think everything is okay with this, I will squash the last patch and 
submit patches upstream.

Thanks,
Damien

Reply via email to