Function ioremap() returns a NULL pointer on failures. In function lanai_dev_open() defined in file drivers/atm/lanai.c, function ioremap() is called and its return value is checked against NULL (at line 2144). If the return value is NULL, it will jump to label "error_pci", and returns the value of variable result. The value of result is 0 after the check of it at line 2140. As a result, 0 may be returned even if the call to ioremap() fails. Maybe it is better to explicitly assign "-ENOMEM" to variable result before the jump instruction at line 2146. Codes related to this bug are summarised as follows. lanai_dev_open @@ drivers/atm/lanai.c 2112 /* setup a newly detected device */ 2113 static int lanai_dev_open(struct atm_dev *atmdev) 2114 { 2115 struct lanai_dev *lanai = (struct lanai_dev *) atmdev->dev_data; 2116 unsigned long raw_base; 2117 int result; ... 2139 /* 3.2: PCI initialization */ 2140 if ((result = lanai_pci_start(lanai)) != 0) 2141 goto error; 2142 raw_base = lanai->pci->resource[0].start; 2143 lanai->base = (bus_addr_t) ioremap(raw_base, LANAI_MAPPING_SIZE); 2144 if (lanai->base == NULL) { 2145 printk(KERN_ERR DEV_LABEL ": couldn't remap I/O space\n"); 2146 goto error_pci; // insert "result = -ENOMEM" before this jump instruction? 2147 } ... 2229 return 0; 2230 ... 2242 error_pci: 2243 pci_disable_device(lanai->pci); 2244 error: 2245 return result; 2246 } Thanks very much!
Created attachment 256419 [details] The patch fixes the bug The patch has been merged into the latest version of the Linux kernel. So I will close the bug.