tree: https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next head: 8d3a1cb32124eaeb3f2efe4889de214d3b658d8d commit: 3c985d31ad661a2cc0ad0a55105046fc56a7b1fd [7/57] powerpc: Use common of_kexec_alloc_and_setup_fdt() config: powerpc-randconfig-m031-20210403 (attached as .config) compiler: powerpc64-linux-gcc (GCC) 9.3.0
If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <l...@intel.com> Reported-by: Dan Carpenter <dan.carpen...@oracle.com> smatch warnings: arch/powerpc/kexec/elf_64.c:153 elf64_load() error: uninitialized symbol 'fdt'. vim +/fdt +153 arch/powerpc/kexec/elf_64.c a0458284f0625a arch/powerpc/kernel/kexec_elf_64.c Thiago Jung Bauermann 2016-11-29 27 static void *elf64_load(struct kimage *image, char *kernel_buf, a0458284f0625a arch/powerpc/kernel/kexec_elf_64.c Thiago Jung Bauermann 2016-11-29 28 unsigned long kernel_len, char *initrd, a0458284f0625a arch/powerpc/kernel/kexec_elf_64.c Thiago Jung Bauermann 2016-11-29 29 unsigned long initrd_len, char *cmdline, a0458284f0625a arch/powerpc/kernel/kexec_elf_64.c Thiago Jung Bauermann 2016-11-29 30 unsigned long cmdline_len) a0458284f0625a arch/powerpc/kernel/kexec_elf_64.c Thiago Jung Bauermann 2016-11-29 31 { a0458284f0625a arch/powerpc/kernel/kexec_elf_64.c Thiago Jung Bauermann 2016-11-29 32 int ret; 3be3f61d25e04e arch/powerpc/kernel/kexec_elf_64.c Philipp Rudo 2018-04-13 33 unsigned long kernel_load_addr; a0458284f0625a arch/powerpc/kernel/kexec_elf_64.c Thiago Jung Bauermann 2016-11-29 34 unsigned long initrd_load_addr = 0, fdt_load_addr; a0458284f0625a arch/powerpc/kernel/kexec_elf_64.c Thiago Jung Bauermann 2016-11-29 35 void *fdt; a0458284f0625a arch/powerpc/kernel/kexec_elf_64.c Thiago Jung Bauermann 2016-11-29 36 const void *slave_code; a0458284f0625a arch/powerpc/kernel/kexec_elf_64.c Thiago Jung Bauermann 2016-11-29 37 struct elfhdr ehdr; cb350c1f1f867d arch/powerpc/kexec/elf_64.c Hari Bathini 2020-07-29 38 char *modified_cmdline = NULL; 175fca3bf91a11 arch/powerpc/kernel/kexec_elf_64.c Sven Schnelle 2019-08-23 39 struct kexec_elf_info elf_info; a0458284f0625a arch/powerpc/kernel/kexec_elf_64.c Thiago Jung Bauermann 2016-11-29 40 struct kexec_buf kbuf = { .image = image, .buf_min = 0, a0458284f0625a arch/powerpc/kernel/kexec_elf_64.c Thiago Jung Bauermann 2016-11-29 41 .buf_max = ppc64_rma_size }; 3be3f61d25e04e arch/powerpc/kernel/kexec_elf_64.c Philipp Rudo 2018-04-13 42 struct kexec_buf pbuf = { .image = image, .buf_min = 0, 8b909e3548706c arch/powerpc/kernel/kexec_elf_64.c Thiago Jung Bauermann 2019-05-22 43 .buf_max = ppc64_rma_size, .top_down = true, 8b909e3548706c arch/powerpc/kernel/kexec_elf_64.c Thiago Jung Bauermann 2019-05-22 44 .mem = KEXEC_BUF_MEM_UNKNOWN }; a0458284f0625a arch/powerpc/kernel/kexec_elf_64.c Thiago Jung Bauermann 2016-11-29 45 175fca3bf91a11 arch/powerpc/kernel/kexec_elf_64.c Sven Schnelle 2019-08-23 46 ret = kexec_build_elf_info(kernel_buf, kernel_len, &ehdr, &elf_info); a0458284f0625a arch/powerpc/kernel/kexec_elf_64.c Thiago Jung Bauermann 2016-11-29 47 if (ret) a0458284f0625a arch/powerpc/kernel/kexec_elf_64.c Thiago Jung Bauermann 2016-11-29 48 goto out; a0458284f0625a arch/powerpc/kernel/kexec_elf_64.c Thiago Jung Bauermann 2016-11-29 49 b8e55a3e5c2088 arch/powerpc/kexec/elf_64.c Hari Bathini 2020-07-29 50 if (image->type == KEXEC_TYPE_CRASH) { b8e55a3e5c2088 arch/powerpc/kexec/elf_64.c Hari Bathini 2020-07-29 51 /* min & max buffer values for kdump case */ b8e55a3e5c2088 arch/powerpc/kexec/elf_64.c Hari Bathini 2020-07-29 52 kbuf.buf_min = pbuf.buf_min = crashk_res.start; b8e55a3e5c2088 arch/powerpc/kexec/elf_64.c Hari Bathini 2020-07-29 53 kbuf.buf_max = pbuf.buf_max = b8e55a3e5c2088 arch/powerpc/kexec/elf_64.c Hari Bathini 2020-07-29 54 ((crashk_res.end < ppc64_rma_size) ? b8e55a3e5c2088 arch/powerpc/kexec/elf_64.c Hari Bathini 2020-07-29 55 crashk_res.end : (ppc64_rma_size - 1)); b8e55a3e5c2088 arch/powerpc/kexec/elf_64.c Hari Bathini 2020-07-29 56 } b8e55a3e5c2088 arch/powerpc/kexec/elf_64.c Hari Bathini 2020-07-29 57 175fca3bf91a11 arch/powerpc/kernel/kexec_elf_64.c Sven Schnelle 2019-08-23 58 ret = kexec_elf_load(image, &ehdr, &elf_info, &kbuf, &kernel_load_addr); a0458284f0625a arch/powerpc/kernel/kexec_elf_64.c Thiago Jung Bauermann 2016-11-29 59 if (ret) a0458284f0625a arch/powerpc/kernel/kexec_elf_64.c Thiago Jung Bauermann 2016-11-29 60 goto out; a0458284f0625a arch/powerpc/kernel/kexec_elf_64.c Thiago Jung Bauermann 2016-11-29 61 a0458284f0625a arch/powerpc/kernel/kexec_elf_64.c Thiago Jung Bauermann 2016-11-29 62 pr_debug("Loaded the kernel at 0x%lx\n", kernel_load_addr); a0458284f0625a arch/powerpc/kernel/kexec_elf_64.c Thiago Jung Bauermann 2016-11-29 63 3be3f61d25e04e arch/powerpc/kernel/kexec_elf_64.c Philipp Rudo 2018-04-13 64 ret = kexec_load_purgatory(image, &pbuf); a0458284f0625a arch/powerpc/kernel/kexec_elf_64.c Thiago Jung Bauermann 2016-11-29 65 if (ret) { a0458284f0625a arch/powerpc/kernel/kexec_elf_64.c Thiago Jung Bauermann 2016-11-29 66 pr_err("Loading purgatory failed.\n"); a0458284f0625a arch/powerpc/kernel/kexec_elf_64.c Thiago Jung Bauermann 2016-11-29 67 goto out; ^^^^^^^^^ There are a few "goto out;" statements before "ftd" is initialized. a0458284f0625a arch/powerpc/kernel/kexec_elf_64.c Thiago Jung Bauermann 2016-11-29 68 } a0458284f0625a arch/powerpc/kernel/kexec_elf_64.c Thiago Jung Bauermann 2016-11-29 69 3be3f61d25e04e arch/powerpc/kernel/kexec_elf_64.c Philipp Rudo 2018-04-13 70 pr_debug("Loaded purgatory at 0x%lx\n", pbuf.mem); a0458284f0625a arch/powerpc/kernel/kexec_elf_64.c Thiago Jung Bauermann 2016-11-29 71 1a1cf93c200581 arch/powerpc/kexec/elf_64.c Hari Bathini 2020-07-29 72 /* Load additional segments needed for panic kernel */ 1a1cf93c200581 arch/powerpc/kexec/elf_64.c Hari Bathini 2020-07-29 73 if (image->type == KEXEC_TYPE_CRASH) { 1a1cf93c200581 arch/powerpc/kexec/elf_64.c Hari Bathini 2020-07-29 74 ret = load_crashdump_segments_ppc64(image, &kbuf); 1a1cf93c200581 arch/powerpc/kexec/elf_64.c Hari Bathini 2020-07-29 75 if (ret) { 1a1cf93c200581 arch/powerpc/kexec/elf_64.c Hari Bathini 2020-07-29 76 pr_err("Failed to load kdump kernel segments\n"); 1a1cf93c200581 arch/powerpc/kexec/elf_64.c Hari Bathini 2020-07-29 77 goto out; 1a1cf93c200581 arch/powerpc/kexec/elf_64.c Hari Bathini 2020-07-29 78 } cb350c1f1f867d arch/powerpc/kexec/elf_64.c Hari Bathini 2020-07-29 79 cb350c1f1f867d arch/powerpc/kexec/elf_64.c Hari Bathini 2020-07-29 80 /* Setup cmdline for kdump kernel case */ cb350c1f1f867d arch/powerpc/kexec/elf_64.c Hari Bathini 2020-07-29 81 modified_cmdline = setup_kdump_cmdline(image, cmdline, cb350c1f1f867d arch/powerpc/kexec/elf_64.c Hari Bathini 2020-07-29 82 cmdline_len); cb350c1f1f867d arch/powerpc/kexec/elf_64.c Hari Bathini 2020-07-29 83 if (!modified_cmdline) { cb350c1f1f867d arch/powerpc/kexec/elf_64.c Hari Bathini 2020-07-29 84 pr_err("Setting up cmdline for kdump kernel failed\n"); cb350c1f1f867d arch/powerpc/kexec/elf_64.c Hari Bathini 2020-07-29 85 ret = -EINVAL; cb350c1f1f867d arch/powerpc/kexec/elf_64.c Hari Bathini 2020-07-29 86 goto out; cb350c1f1f867d arch/powerpc/kexec/elf_64.c Hari Bathini 2020-07-29 87 } cb350c1f1f867d arch/powerpc/kexec/elf_64.c Hari Bathini 2020-07-29 88 cmdline = modified_cmdline; 1a1cf93c200581 arch/powerpc/kexec/elf_64.c Hari Bathini 2020-07-29 89 } 1a1cf93c200581 arch/powerpc/kexec/elf_64.c Hari Bathini 2020-07-29 90 a0458284f0625a arch/powerpc/kernel/kexec_elf_64.c Thiago Jung Bauermann 2016-11-29 91 if (initrd != NULL) { a0458284f0625a arch/powerpc/kernel/kexec_elf_64.c Thiago Jung Bauermann 2016-11-29 92 kbuf.buffer = initrd; a0458284f0625a arch/powerpc/kernel/kexec_elf_64.c Thiago Jung Bauermann 2016-11-29 93 kbuf.bufsz = kbuf.memsz = initrd_len; a0458284f0625a arch/powerpc/kernel/kexec_elf_64.c Thiago Jung Bauermann 2016-11-29 94 kbuf.buf_align = PAGE_SIZE; a0458284f0625a arch/powerpc/kernel/kexec_elf_64.c Thiago Jung Bauermann 2016-11-29 95 kbuf.top_down = false; 8b909e3548706c arch/powerpc/kernel/kexec_elf_64.c Thiago Jung Bauermann 2019-05-22 96 kbuf.mem = KEXEC_BUF_MEM_UNKNOWN; a0458284f0625a arch/powerpc/kernel/kexec_elf_64.c Thiago Jung Bauermann 2016-11-29 97 ret = kexec_add_buffer(&kbuf); a0458284f0625a arch/powerpc/kernel/kexec_elf_64.c Thiago Jung Bauermann 2016-11-29 98 if (ret) a0458284f0625a arch/powerpc/kernel/kexec_elf_64.c Thiago Jung Bauermann 2016-11-29 99 goto out; a0458284f0625a arch/powerpc/kernel/kexec_elf_64.c Thiago Jung Bauermann 2016-11-29 100 initrd_load_addr = kbuf.mem; a0458284f0625a arch/powerpc/kernel/kexec_elf_64.c Thiago Jung Bauermann 2016-11-29 101 a0458284f0625a arch/powerpc/kernel/kexec_elf_64.c Thiago Jung Bauermann 2016-11-29 102 pr_debug("Loaded initrd at 0x%lx\n", initrd_load_addr); a0458284f0625a arch/powerpc/kernel/kexec_elf_64.c Thiago Jung Bauermann 2016-11-29 103 } a0458284f0625a arch/powerpc/kernel/kexec_elf_64.c Thiago Jung Bauermann 2016-11-29 104 3c985d31ad661a arch/powerpc/kexec/elf_64.c Rob Herring 2021-02-21 105 fdt = of_kexec_alloc_and_setup_fdt(image, initrd_load_addr, 3c985d31ad661a arch/powerpc/kexec/elf_64.c Rob Herring 2021-02-21 106 initrd_len, cmdline, 3c985d31ad661a arch/powerpc/kexec/elf_64.c Rob Herring 2021-02-21 107 kexec_fdt_totalsize_ppc64(image)); a0458284f0625a arch/powerpc/kernel/kexec_elf_64.c Thiago Jung Bauermann 2016-11-29 108 if (!fdt) { a0458284f0625a arch/powerpc/kernel/kexec_elf_64.c Thiago Jung Bauermann 2016-11-29 109 pr_err("Error setting up the new device tree.\n"); a0458284f0625a arch/powerpc/kernel/kexec_elf_64.c Thiago Jung Bauermann 2016-11-29 110 ret = -EINVAL; a0458284f0625a arch/powerpc/kernel/kexec_elf_64.c Thiago Jung Bauermann 2016-11-29 111 goto out; a0458284f0625a arch/powerpc/kernel/kexec_elf_64.c Thiago Jung Bauermann 2016-11-29 112 } a0458284f0625a arch/powerpc/kernel/kexec_elf_64.c Thiago Jung Bauermann 2016-11-29 113 19031275a58812 arch/powerpc/kexec/elf_64.c Hari Bathini 2020-07-29 114 ret = setup_new_fdt_ppc64(image, fdt, initrd_load_addr, 19031275a58812 arch/powerpc/kexec/elf_64.c Hari Bathini 2020-07-29 115 initrd_len, cmdline); a0458284f0625a arch/powerpc/kernel/kexec_elf_64.c Thiago Jung Bauermann 2016-11-29 116 if (ret) a0458284f0625a arch/powerpc/kernel/kexec_elf_64.c Thiago Jung Bauermann 2016-11-29 117 goto out; a0458284f0625a arch/powerpc/kernel/kexec_elf_64.c Thiago Jung Bauermann 2016-11-29 118 a0458284f0625a arch/powerpc/kernel/kexec_elf_64.c Thiago Jung Bauermann 2016-11-29 119 fdt_pack(fdt); a0458284f0625a arch/powerpc/kernel/kexec_elf_64.c Thiago Jung Bauermann 2016-11-29 120 a0458284f0625a arch/powerpc/kernel/kexec_elf_64.c Thiago Jung Bauermann 2016-11-29 121 kbuf.buffer = fdt; 3c985d31ad661a arch/powerpc/kexec/elf_64.c Rob Herring 2021-02-21 122 kbuf.bufsz = kbuf.memsz = fdt_totalsize(fdt); a0458284f0625a arch/powerpc/kernel/kexec_elf_64.c Thiago Jung Bauermann 2016-11-29 123 kbuf.buf_align = PAGE_SIZE; a0458284f0625a arch/powerpc/kernel/kexec_elf_64.c Thiago Jung Bauermann 2016-11-29 124 kbuf.top_down = true; 8b909e3548706c arch/powerpc/kernel/kexec_elf_64.c Thiago Jung Bauermann 2019-05-22 125 kbuf.mem = KEXEC_BUF_MEM_UNKNOWN; a0458284f0625a arch/powerpc/kernel/kexec_elf_64.c Thiago Jung Bauermann 2016-11-29 126 ret = kexec_add_buffer(&kbuf); a0458284f0625a arch/powerpc/kernel/kexec_elf_64.c Thiago Jung Bauermann 2016-11-29 127 if (ret) a0458284f0625a arch/powerpc/kernel/kexec_elf_64.c Thiago Jung Bauermann 2016-11-29 128 goto out; 3c985d31ad661a arch/powerpc/kexec/elf_64.c Rob Herring 2021-02-21 129 3c985d31ad661a arch/powerpc/kexec/elf_64.c Rob Herring 2021-02-21 130 /* FDT will be freed in arch_kimage_file_post_load_cleanup */ 3c985d31ad661a arch/powerpc/kexec/elf_64.c Rob Herring 2021-02-21 131 image->arch.fdt = fdt; ^^^^^^^^^^^^^^^^^^^^^ This line means no free after this point. 3c985d31ad661a arch/powerpc/kexec/elf_64.c Rob Herring 2021-02-21 132 a0458284f0625a arch/powerpc/kernel/kexec_elf_64.c Thiago Jung Bauermann 2016-11-29 133 fdt_load_addr = kbuf.mem; a0458284f0625a arch/powerpc/kernel/kexec_elf_64.c Thiago Jung Bauermann 2016-11-29 134 a0458284f0625a arch/powerpc/kernel/kexec_elf_64.c Thiago Jung Bauermann 2016-11-29 135 pr_debug("Loaded device tree at 0x%lx\n", fdt_load_addr); a0458284f0625a arch/powerpc/kernel/kexec_elf_64.c Thiago Jung Bauermann 2016-11-29 136 a0458284f0625a arch/powerpc/kernel/kexec_elf_64.c Thiago Jung Bauermann 2016-11-29 137 slave_code = elf_info.buffer + elf_info.proghdrs[0].p_offset; 19031275a58812 arch/powerpc/kexec/elf_64.c Hari Bathini 2020-07-29 138 ret = setup_purgatory_ppc64(image, slave_code, fdt, kernel_load_addr, a0458284f0625a arch/powerpc/kernel/kexec_elf_64.c Thiago Jung Bauermann 2016-11-29 139 fdt_load_addr); a0458284f0625a arch/powerpc/kernel/kexec_elf_64.c Thiago Jung Bauermann 2016-11-29 140 if (ret) a0458284f0625a arch/powerpc/kernel/kexec_elf_64.c Thiago Jung Bauermann 2016-11-29 141 pr_err("Error setting up the purgatory.\n"); a0458284f0625a arch/powerpc/kernel/kexec_elf_64.c Thiago Jung Bauermann 2016-11-29 142 a0458284f0625a arch/powerpc/kernel/kexec_elf_64.c Thiago Jung Bauermann 2016-11-29 143 out: cb350c1f1f867d arch/powerpc/kexec/elf_64.c Hari Bathini 2020-07-29 144 kfree(modified_cmdline); 175fca3bf91a11 arch/powerpc/kernel/kexec_elf_64.c Sven Schnelle 2019-08-23 145 kexec_free_elf_info(&elf_info); a0458284f0625a arch/powerpc/kernel/kexec_elf_64.c Thiago Jung Bauermann 2016-11-29 146 3c985d31ad661a arch/powerpc/kexec/elf_64.c Rob Herring 2021-02-21 147 /* 3c985d31ad661a arch/powerpc/kexec/elf_64.c Rob Herring 2021-02-21 148 * Once FDT buffer has been successfully passed to kexec_add_buffer(), 3c985d31ad661a arch/powerpc/kexec/elf_64.c Rob Herring 2021-02-21 149 * the FDT buffer address is saved in image->arch.fdt. In that case, 3c985d31ad661a arch/powerpc/kexec/elf_64.c Rob Herring 2021-02-21 150 * the memory cannot be freed here in case of any other error. 3c985d31ad661a arch/powerpc/kexec/elf_64.c Rob Herring 2021-02-21 151 */ 3c985d31ad661a arch/powerpc/kexec/elf_64.c Rob Herring 2021-02-21 152 if (ret && !image->arch.fdt) 3c985d31ad661a arch/powerpc/kexec/elf_64.c Rob Herring 2021-02-21 @153 kvfree(fdt); ^^^^^^^^^^^^ Freeing uninitialized. 3c985d31ad661a arch/powerpc/kexec/elf_64.c Rob Herring 2021-02-21 154 3c985d31ad661a arch/powerpc/kexec/elf_64.c Rob Herring 2021-02-21 155 return ret ? ERR_PTR(ret) : NULL; a0458284f0625a arch/powerpc/kernel/kexec_elf_64.c Thiago Jung Bauermann 2016-11-29 156 } --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org
.config.gz
Description: application/gzip
_______________________________________________ kbuild mailing list -- kbuild@lists.01.org To unsubscribe send an email to kbuild-le...@lists.01.org
_______________________________________________ kbuild mailing list -- kbuild@lists.01.org To unsubscribe send an email to kbuild-le...@lists.01.org