Hello, Joan Lledó, le dim. 12 déc. 2021 13:52:14 +0100, a ecrit: > + err = io_map (file, &robj, &wobj); > + mach_port_deallocate (mach_task_self(), file); > + if (err) > + return err; > + > + switch (prot & (VM_PROT_READ|VM_PROT_WRITE)) { > + case VM_PROT_READ: > + pager = robj; > + if (wobj != MACH_PORT_NULL) > + mach_port_deallocate (mach_task_self(), wobj); > + break; > + case VM_PROT_READ|VM_PROT_WRITE: > + if (robj == wobj) { > + pager = wobj; > + /* Remove extra reference. */ > + mach_port_deallocate (mach_task_self (), pager); > + } > + else if (wobj == MACH_PORT_NULL) { > + /* We asked for write permissions but they weren't granted. */ > + mach_port_deallocate (mach_task_self (), robj); > + return EPERM; > + }
Don't we need else { pager = wobj; } ? Otherwise pager would be undefined. Note: better *not* initialize the robj/wobj/pager variables by default, so that the compiler does catch such mistakes and emit a warning. > @@ -523,18 +630,18 @@ pci_system_hurd_create(void) > > pci_sys->num_devices = 0; > > - if ((err = get_privileged_ports (NULL, &device_master)) || > (device_master == MACH_PORT_NULL)) { > - pci_system_cleanup(); > - return err; > - } > - > - err = device_open (device_master, D_READ|D_WRITE, "pci", &pci_port); > - if (!err) { > - root = file_name_lookup_under (pci_port, ".", O_DIRECTORY | O_RDWR | > O_EXEC, 0); > - } > - > - if (!root) { > - root = file_name_lookup (_SERVERS_BUS_PCI, O_RDWR, 0); > + if ((err = get_privileged_ports (NULL, &device_master)) > + || (device_master == MACH_PORT_NULL)) { > + root = file_name_lookup (_SERVERS_BUS_PCI, O_RDONLY, 0); > + } else { > + err = device_open (device_master, D_READ, "pci", &pci_port); > + mach_port_deallocate (mach_task_self (), device_master); > + if (!err) { > + root = file_name_lookup_under (pci_port, ".", > + O_DIRECTORY | O_RDONLY | O_EXEC, > 0); > + } > + device_close (pci_port); > + mach_port_deallocate (mach_task_self (), pci_port); These two should be inside if (!err) > } > > if (!root) {