openprom: Add NULL check for pdev in oprompci2node()
PATCH 1/1 openprom: Add NULL check for pdev in oprompci2node()
Since pci_get_domain_bus_and_slot() can return NULL, add NULL check for pdev in oprompci2node().
This change is similar to the fix implemented in commit 9af152dcf1a0 ("drm/gma500: Add NULL check for pci_gfx_root in mid_get_vbt_data()").
Signed-off-by Chenyuan Yang <[email protected]>
--- drivers/sbus/char/openprom.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/sbus/char/openprom.c +2 -0
@@ -241,6 +241,8 @@ static int oprompci2node(void __user *argp, struct device_node *dp, struct openp pdev =pci_get_domain_bus_and_slot (0 , ((int *) op->oprom_array)[0 ], ((int *) op->oprom_array)[1 ]); +if (!pdev) +return -ENODEV ; dp =pci_device_to_OF_node (pdev); data->current_node = dp;
Signature · 1 line
2.34.1