Skip to content

Commit cc5cd50

Browse files
XidianGeneralBoris Ostrovsky
authored andcommitted
xen: xen-pciback: Replace GFP_ATOMIC with GFP_KERNEL in pcistub_probe
pcistub_probe() is never called in atomic context. This function is only set as ".probe" in struct pci_driver. Despite never getting called from atomic context, pcistub_probe() calls kmalloc() with GFP_ATOMIC, which does not sleep for allocation. GFP_ATOMIC is not necessary and can be replaced with GFP_KERNEL, which can sleep and improve the possibility of sucessful allocation. This is found by a static analysis tool named DCNS written by myself. And I also manually check it. Signed-off-by: Jia-Ju Bai <[email protected]> Reviewed-by: Boris Ostrovsky <[email protected]> Signed-off-by: Boris Ostrovsky <[email protected]>
1 parent a5a18ae commit cc5cd50

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/xen/xen-pciback/pci_stub.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,7 @@ static int pcistub_probe(struct pci_dev *dev, const struct pci_device_id *id)
577577
}
578578

579579
if (!match) {
580-
pci_dev_id = kmalloc(sizeof(*pci_dev_id), GFP_ATOMIC);
580+
pci_dev_id = kmalloc(sizeof(*pci_dev_id), GFP_KERNEL);
581581
if (!pci_dev_id) {
582582
err = -ENOMEM;
583583
goto out;

0 commit comments

Comments
 (0)