[intel-lts:6.18/linux 1/1] kernel/kexec_handover.c:941 kho_preserve_vmalloc() warn: missing error code 'err'
kernel test robot <[email protected]> Sun, 26 Jul 2026 00:28:50 +0800
| Newsgroups | dev.linux.lists.oe-kbuild,dev.linux.lists.oe-kbuild-all |
|---|---|
| Message-ID | <[email protected]> |
BCC: [email protected] CC: [email protected] tree: https://github.com/intel/linux-intel-lts.git 6.18/linux head: af406d75818b912a1b72efa75a20f8bf3e9a3f01 commit: a667300bd53f272a3055238bcefe108f88836270 [1/1] kho: add support for preserving vmalloc allocations :::::: branch date: 9 days ago :::::: commit date: 10 months ago config: x86_64-randconfig-161-20260725 (https://download.01.org/0day-ci/archive/20260726/[email protected]/config) compiler: gcc-14 (Debian 14.2.0-19) 14.2.0 smatch: v0.5.0-9187-g5189e3fb If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Fixes: a667300bd53f ("kho: add support for preserving vmalloc allocations") | Reported-by: kernel test robot <[email protected]> | Reported-by: Dan Carpenter <[email protected]> | Closes: https://lore.kernel.org/r/[email protected]/ smatch warnings: kernel/kexec_handover.c:941 kho_preserve_vmalloc() warn: missing error code 'err' vim +/err +941 kernel/kexec_handover.c a667300bd53f27 Mike Rapoport (Microsoft 2025-09-21 891) a667300bd53f27 Mike Rapoport (Microsoft 2025-09-21 892) /** a667300bd53f27 Mike Rapoport (Microsoft 2025-09-21 893) * kho_preserve_vmalloc - preserve memory allocated with vmalloc() across kexec a667300bd53f27 Mike Rapoport (Microsoft 2025-09-21 894) * @ptr: pointer to the area in vmalloc address space a667300bd53f27 Mike Rapoport (Microsoft 2025-09-21 895) * @preservation: placeholder for preservation metadata a667300bd53f27 Mike Rapoport (Microsoft 2025-09-21 896) * a667300bd53f27 Mike Rapoport (Microsoft 2025-09-21 897) * Instructs KHO to preserve the area in vmalloc address space at @ptr. The a667300bd53f27 Mike Rapoport (Microsoft 2025-09-21 898) * physical pages mapped at @ptr will be preserved and on successful return a667300bd53f27 Mike Rapoport (Microsoft 2025-09-21 899) * @preservation will hold the physical address of a structure that describes a667300bd53f27 Mike Rapoport (Microsoft 2025-09-21 900) * the preservation. a667300bd53f27 Mike Rapoport (Microsoft 2025-09-21 901) * a667300bd53f27 Mike Rapoport (Microsoft 2025-09-21 902) * NOTE: The memory allocated with vmalloc_node() variants cannot be reliably a667300bd53f27 Mike Rapoport (Microsoft 2025-09-21 903) * restored on the same node a667300bd53f27 Mike Rapoport (Microsoft 2025-09-21 904) * a667300bd53f27 Mike Rapoport (Microsoft 2025-09-21 905) * Return: 0 on success, error code on failure a667300bd53f27 Mike Rapoport (Microsoft 2025-09-21 906) */ a667300bd53f27 Mike Rapoport (Microsoft 2025-09-21 907) int kho_preserve_vmalloc(void *ptr, struct kho_vmalloc *preservation) a667300bd53f27 Mike Rapoport (Microsoft 2025-09-21 908) { a667300bd53f27 Mike Rapoport (Microsoft 2025-09-21 909) struct kho_vmalloc_chunk *chunk; a667300bd53f27 Mike Rapoport (Microsoft 2025-09-21 910) struct vm_struct *vm = find_vm_area(ptr); a667300bd53f27 Mike Rapoport (Microsoft 2025-09-21 911) unsigned int order, flags, nr_contig_pages; a667300bd53f27 Mike Rapoport (Microsoft 2025-09-21 912) unsigned int idx = 0; a667300bd53f27 Mike Rapoport (Microsoft 2025-09-21 913) int err; a667300bd53f27 Mike Rapoport (Microsoft 2025-09-21 914) a667300bd53f27 Mike Rapoport (Microsoft 2025-09-21 915) if (!vm) a667300bd53f27 Mike Rapoport (Microsoft 2025-09-21 916) return -EINVAL; a667300bd53f27 Mike Rapoport (Microsoft 2025-09-21 917) a667300bd53f27 Mike Rapoport (Microsoft 2025-09-21 918) if (vm->flags & ~KHO_VMALLOC_SUPPORTED_FLAGS) a667300bd53f27 Mike Rapoport (Microsoft 2025-09-21 919) return -EOPNOTSUPP; a667300bd53f27 Mike Rapoport (Microsoft 2025-09-21 920) a667300bd53f27 Mike Rapoport (Microsoft 2025-09-21 921) flags = vmalloc_flags_to_kho(vm->flags); a667300bd53f27 Mike Rapoport (Microsoft 2025-09-21 922) order = get_vm_area_page_order(vm); a667300bd53f27 Mike Rapoport (Microsoft 2025-09-21 923) a667300bd53f27 Mike Rapoport (Microsoft 2025-09-21 924) chunk = new_vmalloc_chunk(NULL); a667300bd53f27 Mike Rapoport (Microsoft 2025-09-21 925) if (!chunk) a667300bd53f27 Mike Rapoport (Microsoft 2025-09-21 926) return -ENOMEM; a667300bd53f27 Mike Rapoport (Microsoft 2025-09-21 927) KHOSER_STORE_PTR(preservation->first, chunk); a667300bd53f27 Mike Rapoport (Microsoft 2025-09-21 928) a667300bd53f27 Mike Rapoport (Microsoft 2025-09-21 929) nr_contig_pages = (1 << order); a667300bd53f27 Mike Rapoport (Microsoft 2025-09-21 930) for (int i = 0; i < vm->nr_pages; i += nr_contig_pages) { a667300bd53f27 Mike Rapoport (Microsoft 2025-09-21 931) phys_addr_t phys = page_to_phys(vm->pages[i]); a667300bd53f27 Mike Rapoport (Microsoft 2025-09-21 932) a667300bd53f27 Mike Rapoport (Microsoft 2025-09-21 933) err = kho_preserve_pages(vm->pages[i], nr_contig_pages); a667300bd53f27 Mike Rapoport (Microsoft 2025-09-21 934) if (err) a667300bd53f27 Mike Rapoport (Microsoft 2025-09-21 935) goto err_free; a667300bd53f27 Mike Rapoport (Microsoft 2025-09-21 936) a667300bd53f27 Mike Rapoport (Microsoft 2025-09-21 937) chunk->phys[idx++] = phys; a667300bd53f27 Mike Rapoport (Microsoft 2025-09-21 938) if (idx == ARRAY_SIZE(chunk->phys)) { a667300bd53f27 Mike Rapoport (Microsoft 2025-09-21 939) chunk = new_vmalloc_chunk(chunk); a667300bd53f27 Mike Rapoport (Microsoft 2025-09-21 940) if (!chunk) a667300bd53f27 Mike Rapoport (Microsoft 2025-09-21 @941) goto err_free; a667300bd53f27 Mike Rapoport (Microsoft 2025-09-21 942) idx = 0; a667300bd53f27 Mike Rapoport (Microsoft 2025-09-21 943) } a667300bd53f27 Mike Rapoport (Microsoft 2025-09-21 944) } a667300bd53f27 Mike Rapoport (Microsoft 2025-09-21 945) a667300bd53f27 Mike Rapoport (Microsoft 2025-09-21 946) preservation->total_pages = vm->nr_pages; a667300bd53f27 Mike Rapoport (Microsoft 2025-09-21 947) preservation->flags = flags; a667300bd53f27 Mike Rapoport (Microsoft 2025-09-21 948) preservation->order = order; a667300bd53f27 Mike Rapoport (Microsoft 2025-09-21 949) a667300bd53f27 Mike Rapoport (Microsoft 2025-09-21 950) return 0; a667300bd53f27 Mike Rapoport (Microsoft 2025-09-21 951) a667300bd53f27 Mike Rapoport (Microsoft 2025-09-21 952) err_free: a667300bd53f27 Mike Rapoport (Microsoft 2025-09-21 953) kho_vmalloc_free_chunks(preservation); a667300bd53f27 Mike Rapoport (Microsoft 2025-09-21 954) return err; a667300bd53f27 Mike Rapoport (Microsoft 2025-09-21 955) } a667300bd53f27 Mike Rapoport (Microsoft 2025-09-21 956) EXPORT_SYMBOL_GPL(kho_preserve_vmalloc); a667300bd53f27 Mike Rapoport (Microsoft 2025-09-21 957) -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki