]> www.infradead.org Git - users/hch/misc.git/commitdiff
parisc: Fix iodc and device path return values on old machines
authorHelge Deller <deller@gmx.de>
Thu, 9 Oct 2025 21:37:28 +0000 (23:37 +0200)
committerHelge Deller <deller@gmx.de>
Thu, 9 Oct 2025 21:45:04 +0000 (23:45 +0200)
Older machines may not fully initialize the return values when asking for IODC
and device path data when building the inventory.  Work around possible
firmware leaks by proper initialization of the variables.

Signed-off-by: Helge Deller <deller@gmx.de>
arch/parisc/kernel/drivers.c

index 1e793f770f719dd2a980968ccfd65cd241891cfe..1f8936fc229281203dbd31856bdbccc4f66df076 100644 (file)
@@ -995,6 +995,7 @@ static __init int qemu_print_iodc_data(struct device *lin_dev, void *data)
        struct pdc_system_map_mod_info pdc_mod_info;
        struct pdc_module_path mod_path;
 
+       memset(&iodc_data, 0, sizeof(iodc_data));
        status = pdc_iodc_read(&count, hpa, 0,
                &iodc_data, sizeof(iodc_data));
        if (status != PDC_OK) {
@@ -1012,6 +1013,11 @@ static __init int qemu_print_iodc_data(struct device *lin_dev, void *data)
 
        mod_index = 0;
        do {
+               /* initialize device path for old machines */
+               memset(&mod_path, 0xff, sizeof(mod_path));
+               get_node_path(dev->dev.parent, &mod_path.path);
+               mod_path.path.mod = dev->hw_path;
+               memset(&pdc_mod_info, 0, sizeof(pdc_mod_info));
                status = pdc_system_map_find_mods(&pdc_mod_info,
                                &mod_path, mod_index++);
        } while (status == PDC_OK && pdc_mod_info.mod_addr != hpa);