[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <29aa717b-a862-e6b0-0286-9dd948968efa@linux.microsoft.com>
Date: Mon, 6 Dec 2021 12:33:07 -0800
From: Lakshmi Ramasubramanian <nramas@...ux.microsoft.com>
To: Rob Herring <robh@...nel.org>,
Dan Carpenter <dan.carpenter@...cle.com>
Cc: kbuild@...ts.01.org, lkp@...el.com, kbuild-all@...ts.01.org,
linux-kernel@...r.kernel.org,
Thiago Jung Bauermann <bauerman@...ux.ibm.com>
Subject: Re: arch/arm64/kernel/machine_kexec_file.c:152 load_other_segments()
warn: missing error code 'ret'
Yes Rob - will do it this week.
thanks,
-lakshmi
On 12/6/2021 12:31 PM, Rob Herring wrote:
> On Wed, Dec 1, 2021 at 5:47 AM Dan Carpenter <dan.carpenter@...cle.com> wrote:
>>
>> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
>> head: c5c17547b778975b3d83a73c8d84e8fb5ecf3ba5
>> commit: ac10be5cdbfa852139658d52c2f1c608782ce992 arm64: Use common of_kexec_alloc_and_setup_fdt()
>> config: arm64-randconfig-m031-20211127 (https://download.01.org/0day-ci/archive/20211128/202111280304.FL2314qf-lkp@intel.com/config)
>> compiler: aarch64-linux-gcc (GCC) 11.2.0
>>
>> If you fix the issue, kindly add following tag as appropriate
>> Reported-by: kernel test robot <lkp@...el.com>
>> Reported-by: Dan Carpenter <dan.carpenter@...cle.com>
>>
>> smatch warnings:
>> arch/arm64/kernel/machine_kexec_file.c:152 load_other_segments() warn: missing error code 'ret'
>
> Lakshmi, Can you please prepare a fix for this. It's been reported since July.
>
>>
>> vim +/ret +152 arch/arm64/kernel/machine_kexec_file.c
>>
>> 52b2a8af743604 AKASHI Takahiro 2018-11-15 81 int load_other_segments(struct kimage *image,
>> 52b2a8af743604 AKASHI Takahiro 2018-11-15 82 unsigned long kernel_load_addr,
>> 52b2a8af743604 AKASHI Takahiro 2018-11-15 83 unsigned long kernel_size,
>> 52b2a8af743604 AKASHI Takahiro 2018-11-15 84 char *initrd, unsigned long initrd_len,
>> 52b2a8af743604 AKASHI Takahiro 2018-11-15 85 char *cmdline)
>> 52b2a8af743604 AKASHI Takahiro 2018-11-15 86 {
>> 52b2a8af743604 AKASHI Takahiro 2018-11-15 87 struct kexec_buf kbuf;
>> 3751e728cef290 AKASHI Takahiro 2019-12-16 88 void *headers, *dtb = NULL;
>> 108aa503657ee2 Benjamin Gwin 2020-11-03 89 unsigned long headers_sz, initrd_load_addr = 0, dtb_len,
>> 108aa503657ee2 Benjamin Gwin 2020-11-03 90 orig_segments = image->nr_segments;
>> 52b2a8af743604 AKASHI Takahiro 2018-11-15 91 int ret = 0;
>> 52b2a8af743604 AKASHI Takahiro 2018-11-15 92
>> 52b2a8af743604 AKASHI Takahiro 2018-11-15 93 kbuf.image = image;
>> 52b2a8af743604 AKASHI Takahiro 2018-11-15 94 /* not allocate anything below the kernel */
>> 52b2a8af743604 AKASHI Takahiro 2018-11-15 95 kbuf.buf_min = kernel_load_addr + kernel_size;
>> 52b2a8af743604 AKASHI Takahiro 2018-11-15 96
>> 3751e728cef290 AKASHI Takahiro 2019-12-16 97 /* load elf core header */
>> 3751e728cef290 AKASHI Takahiro 2019-12-16 98 if (image->type == KEXEC_TYPE_CRASH) {
>> 3751e728cef290 AKASHI Takahiro 2019-12-16 99 ret = prepare_elf_headers(&headers, &headers_sz);
>> 3751e728cef290 AKASHI Takahiro 2019-12-16 100 if (ret) {
>> 3751e728cef290 AKASHI Takahiro 2019-12-16 101 pr_err("Preparing elf core header failed\n");
>> 3751e728cef290 AKASHI Takahiro 2019-12-16 102 goto out_err;
>> 3751e728cef290 AKASHI Takahiro 2019-12-16 103 }
>> 3751e728cef290 AKASHI Takahiro 2019-12-16 104
>> 3751e728cef290 AKASHI Takahiro 2019-12-16 105 kbuf.buffer = headers;
>> 3751e728cef290 AKASHI Takahiro 2019-12-16 106 kbuf.bufsz = headers_sz;
>> 3751e728cef290 AKASHI Takahiro 2019-12-16 107 kbuf.mem = KEXEC_BUF_MEM_UNKNOWN;
>> 3751e728cef290 AKASHI Takahiro 2019-12-16 108 kbuf.memsz = headers_sz;
>> 3751e728cef290 AKASHI Takahiro 2019-12-16 109 kbuf.buf_align = SZ_64K; /* largest supported page size */
>> 3751e728cef290 AKASHI Takahiro 2019-12-16 110 kbuf.buf_max = ULONG_MAX;
>> 3751e728cef290 AKASHI Takahiro 2019-12-16 111 kbuf.top_down = true;
>> 3751e728cef290 AKASHI Takahiro 2019-12-16 112
>> 3751e728cef290 AKASHI Takahiro 2019-12-16 113 ret = kexec_add_buffer(&kbuf);
>> 3751e728cef290 AKASHI Takahiro 2019-12-16 114 if (ret) {
>> 3751e728cef290 AKASHI Takahiro 2019-12-16 115 vfree(headers);
>> 3751e728cef290 AKASHI Takahiro 2019-12-16 116 goto out_err;
>> 3751e728cef290 AKASHI Takahiro 2019-12-16 117 }
>> 7b558cc3564e6c Lakshmi Ramasubramanian 2021-02-21 118 image->elf_headers = headers;
>> 7b558cc3564e6c Lakshmi Ramasubramanian 2021-02-21 119 image->elf_load_addr = kbuf.mem;
>> 7b558cc3564e6c Lakshmi Ramasubramanian 2021-02-21 120 image->elf_headers_sz = headers_sz;
>> 3751e728cef290 AKASHI Takahiro 2019-12-16 121
>> 3751e728cef290 AKASHI Takahiro 2019-12-16 122 pr_debug("Loaded elf core header at 0x%lx bufsz=0x%lx memsz=0x%lx\n",
>> 7b558cc3564e6c Lakshmi Ramasubramanian 2021-02-21 123 image->elf_load_addr, kbuf.bufsz, kbuf.memsz);
>> 3751e728cef290 AKASHI Takahiro 2019-12-16 124 }
>> 3751e728cef290 AKASHI Takahiro 2019-12-16 125
>> 52b2a8af743604 AKASHI Takahiro 2018-11-15 126 /* load initrd */
>> 52b2a8af743604 AKASHI Takahiro 2018-11-15 127 if (initrd) {
>> 52b2a8af743604 AKASHI Takahiro 2018-11-15 128 kbuf.buffer = initrd;
>> 52b2a8af743604 AKASHI Takahiro 2018-11-15 129 kbuf.bufsz = initrd_len;
>> c19d050f808812 Bhupesh Sharma 2019-07-11 130 kbuf.mem = KEXEC_BUF_MEM_UNKNOWN;
>> 52b2a8af743604 AKASHI Takahiro 2018-11-15 131 kbuf.memsz = initrd_len;
>> 52b2a8af743604 AKASHI Takahiro 2018-11-15 132 kbuf.buf_align = 0;
>> 52b2a8af743604 AKASHI Takahiro 2018-11-15 133 /* within 1GB-aligned window of up to 32GB in size */
>> 52b2a8af743604 AKASHI Takahiro 2018-11-15 134 kbuf.buf_max = round_down(kernel_load_addr, SZ_1G)
>> 52b2a8af743604 AKASHI Takahiro 2018-11-15 135 + (unsigned long)SZ_1G * 32;
>> 52b2a8af743604 AKASHI Takahiro 2018-11-15 136 kbuf.top_down = false;
>> 52b2a8af743604 AKASHI Takahiro 2018-11-15 137
>> 52b2a8af743604 AKASHI Takahiro 2018-11-15 138 ret = kexec_add_buffer(&kbuf);
>> 52b2a8af743604 AKASHI Takahiro 2018-11-15 139 if (ret)
>> 52b2a8af743604 AKASHI Takahiro 2018-11-15 140 goto out_err;
>> 52b2a8af743604 AKASHI Takahiro 2018-11-15 141 initrd_load_addr = kbuf.mem;
>> 52b2a8af743604 AKASHI Takahiro 2018-11-15 142
>> 52b2a8af743604 AKASHI Takahiro 2018-11-15 143 pr_debug("Loaded initrd at 0x%lx bufsz=0x%lx memsz=0x%lx\n",
>> 51075e0cb759a7 Ćukasz Stelmach 2020-04-30 144 initrd_load_addr, kbuf.bufsz, kbuf.memsz);
>> 52b2a8af743604 AKASHI Takahiro 2018-11-15 145 }
>> 52b2a8af743604 AKASHI Takahiro 2018-11-15 146
>> 52b2a8af743604 AKASHI Takahiro 2018-11-15 147 /* load dtb */
>> ac10be5cdbfa85 Rob Herring 2021-02-21 148 dtb = of_kexec_alloc_and_setup_fdt(image, initrd_load_addr,
>> ac10be5cdbfa85 Rob Herring 2021-02-21 149 initrd_len, cmdline, 0);
>> ac10be5cdbfa85 Rob Herring 2021-02-21 150 if (!dtb) {
>> 52b2a8af743604 AKASHI Takahiro 2018-11-15 151 pr_err("Preparing for new dtb failed\n");
>> 52b2a8af743604 AKASHI Takahiro 2018-11-15 @152 goto out_err;
>> ^^^^^^^^^^^^^
>> This needs an error code.
>>
>> ---
>> 0-DAY CI Kernel Test Service, Intel Corporation
>> https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
>>
Powered by blists - more mailing lists