public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org, Rob Herring <robh@kernel.org>
Cc: lkp@intel.com, kbuild-all@lists.01.org,
	linux-kernel@vger.kernel.org,
	Lakshmi Ramasubramanian <nramas@linux.microsoft.com>,
	Thiago Jung Bauermann <bauerman@linux.ibm.com>
Subject: arch/arm64/kernel/machine_kexec_file.c:152 load_other_segments() warn: missing error code 'ret'
Date: Sat, 3 Jul 2021 16:01:24 +0300	[thread overview]
Message-ID: <202107031042.9GeZ0EQ9-lkp@intel.com> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   d6b63b5b7d7f363c6a54421533791e9849adf2e0
commit: ac10be5cdbfa852139658d52c2f1c608782ce992 arm64: Use common of_kexec_alloc_and_setup_fdt()
config: arm64-randconfig-m031-20210702 (attached as .config)
compiler: aarch64-linux-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
arch/arm64/kernel/machine_kexec_file.c:152 load_other_segments() warn: missing error code 'ret'

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;
                                                                        ^^^^^^^^^^^^^
Set the error code here?  (The kbuild bot chopped of the rest of the
function.  :P)




---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org


             reply	other threads:[~2021-07-03 13:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-03 13:01 Dan Carpenter [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-12-01 11:46 arch/arm64/kernel/machine_kexec_file.c:152 load_other_segments() warn: missing error code 'ret' Dan Carpenter
2021-12-06 20:31 ` Rob Herring
2021-12-06 20:33   ` Lakshmi Ramasubramanian

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202107031042.9GeZ0EQ9-lkp@intel.com \
    --to=dan.carpenter@oracle.com \
    --cc=bauerman@linux.ibm.com \
    --cc=kbuild-all@lists.01.org \
    --cc=kbuild@lists.01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=nramas@linux.microsoft.com \
    --cc=robh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox