public inbox for oe-kbuild@lists.linux.dev
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Dan Carpenter <error27@gmail.com>
Subject: arch/powerpc/kexec/ranges.c:612 get_crash_memory_ranges() warn: we never enter this loop
Date: Tue, 07 Apr 2026 12:03:16 +0800	[thread overview]
Message-ID: <202604071051.dNysR5MD-lkp@intel.com> (raw)

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: linux-kernel@vger.kernel.org
TO: Sourabh Jain <sourabhjain@linux.ibm.com>
CC: Madhavan Srinivasan <maddy@linux.ibm.com>
CC: "Ritesh Harjani (IBM)" <ritesh.list@gmail.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   bfe62a454542cfad3379f6ef5680b125f41e20f4
commit: b4a96ab50f368afc2360ff539a20254ca2c9a889 powerpc/kdump: Add support for crashkernel CMA reservation
date:   5 months ago
:::::: branch date: 11 hours ago
:::::: commit date: 5 months ago
config: powerpc64-randconfig-r072-20260407 (https://download.01.org/0day-ci/archive/20260407/202604071051.dNysR5MD-lkp@intel.com/config)
compiler: clang version 23.0.0git (https://github.com/llvm/llvm-project c80443cd37b2e2788cba67ffa180a6331e5f0791)
smatch: v0.5.0-9004-gb810ac53

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: b4a96ab50f36 ("powerpc/kdump: Add support for crashkernel CMA reservation")
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202604071051.dNysR5MD-lkp@intel.com/

New smatch warnings:
arch/powerpc/kexec/ranges.c:612 get_crash_memory_ranges() warn: we never enter this loop

Old smatch warnings:
arch/powerpc/kexec/ranges.c:531 get_usable_memory_ranges() warn: we never enter this loop

vim +612 arch/powerpc/kexec/ranges.c

b4a96ab50f368af Sourabh Jain 2025-11-07  571  
f5f0da5a7b18fab Sourabh Jain 2024-03-26  572  /**
f5f0da5a7b18fab Sourabh Jain 2024-03-26  573   * get_crash_memory_ranges - Get crash memory ranges. This list includes
f5f0da5a7b18fab Sourabh Jain 2024-03-26  574   *                           first/crashing kernel's memory regions that
f5f0da5a7b18fab Sourabh Jain 2024-03-26  575   *                           would be exported via an elfcore.
f5f0da5a7b18fab Sourabh Jain 2024-03-26  576   * @mem_ranges:              Range list to add the memory ranges to.
f5f0da5a7b18fab Sourabh Jain 2024-03-26  577   *
f5f0da5a7b18fab Sourabh Jain 2024-03-26  578   * Returns 0 on success, negative errno on error.
f5f0da5a7b18fab Sourabh Jain 2024-03-26  579   */
f5f0da5a7b18fab Sourabh Jain 2024-03-26  580  int get_crash_memory_ranges(struct crash_mem **mem_ranges)
f5f0da5a7b18fab Sourabh Jain 2024-03-26  581  {
f5f0da5a7b18fab Sourabh Jain 2024-03-26  582  	phys_addr_t base, end;
f5f0da5a7b18fab Sourabh Jain 2024-03-26  583  	u64 i;
f5f0da5a7b18fab Sourabh Jain 2024-03-26  584  	int ret;
f5f0da5a7b18fab Sourabh Jain 2024-03-26  585  
f5f0da5a7b18fab Sourabh Jain 2024-03-26  586  	for_each_mem_range(i, &base, &end) {
f5f0da5a7b18fab Sourabh Jain 2024-03-26  587  		u64 size = end - base;
f5f0da5a7b18fab Sourabh Jain 2024-03-26  588  
f5f0da5a7b18fab Sourabh Jain 2024-03-26  589  		/* Skip backup memory region, which needs a separate entry */
f5f0da5a7b18fab Sourabh Jain 2024-03-26  590  		if (base == BACKUP_SRC_START) {
f5f0da5a7b18fab Sourabh Jain 2024-03-26  591  			if (size > BACKUP_SRC_SIZE) {
f5f0da5a7b18fab Sourabh Jain 2024-03-26  592  				base = BACKUP_SRC_END + 1;
f5f0da5a7b18fab Sourabh Jain 2024-03-26  593  				size -= BACKUP_SRC_SIZE;
f5f0da5a7b18fab Sourabh Jain 2024-03-26  594  			} else
f5f0da5a7b18fab Sourabh Jain 2024-03-26  595  				continue;
f5f0da5a7b18fab Sourabh Jain 2024-03-26  596  		}
f5f0da5a7b18fab Sourabh Jain 2024-03-26  597  
f5f0da5a7b18fab Sourabh Jain 2024-03-26  598  		ret = add_mem_range(mem_ranges, base, size);
f5f0da5a7b18fab Sourabh Jain 2024-03-26  599  		if (ret)
f5f0da5a7b18fab Sourabh Jain 2024-03-26  600  			goto out;
f5f0da5a7b18fab Sourabh Jain 2024-03-26  601  
f5f0da5a7b18fab Sourabh Jain 2024-03-26  602  		/* Try merging adjacent ranges before reallocation attempt */
f5f0da5a7b18fab Sourabh Jain 2024-03-26  603  		if ((*mem_ranges)->nr_ranges == (*mem_ranges)->max_nr_ranges)
f5f0da5a7b18fab Sourabh Jain 2024-03-26  604  			sort_memory_ranges(*mem_ranges, true);
f5f0da5a7b18fab Sourabh Jain 2024-03-26  605  	}
f5f0da5a7b18fab Sourabh Jain 2024-03-26  606  
b4a96ab50f368af Sourabh Jain 2025-11-07  607  	/* Exclude crashkernel region */
b4a96ab50f368af Sourabh Jain 2025-11-07  608  	ret = crash_exclude_mem_range_guarded(mem_ranges, crashk_res.start, crashk_res.end);
b4a96ab50f368af Sourabh Jain 2025-11-07  609  	if (ret)
f5f0da5a7b18fab Sourabh Jain 2024-03-26  610  		goto out;
f5f0da5a7b18fab Sourabh Jain 2024-03-26  611  
b4a96ab50f368af Sourabh Jain 2025-11-07 @612  	for (i = 0; i < crashk_cma_cnt; ++i) {
b4a96ab50f368af Sourabh Jain 2025-11-07  613  		ret = crash_exclude_mem_range_guarded(mem_ranges, crashk_cma_ranges[i].start,
b4a96ab50f368af Sourabh Jain 2025-11-07  614  					      crashk_cma_ranges[i].end);
f5f0da5a7b18fab Sourabh Jain 2024-03-26  615  		if (ret)
f5f0da5a7b18fab Sourabh Jain 2024-03-26  616  			goto out;
b4a96ab50f368af Sourabh Jain 2025-11-07  617  	}
f5f0da5a7b18fab Sourabh Jain 2024-03-26  618  
f5f0da5a7b18fab Sourabh Jain 2024-03-26  619  	/*
f5f0da5a7b18fab Sourabh Jain 2024-03-26  620  	 * FIXME: For now, stay in parity with kexec-tools but if RTAS/OPAL
f5f0da5a7b18fab Sourabh Jain 2024-03-26  621  	 *        regions are exported to save their context at the time of
f5f0da5a7b18fab Sourabh Jain 2024-03-26  622  	 *        crash, they should actually be backed up just like the
f5f0da5a7b18fab Sourabh Jain 2024-03-26  623  	 *        first 64K bytes of memory.
f5f0da5a7b18fab Sourabh Jain 2024-03-26  624  	 */
f5f0da5a7b18fab Sourabh Jain 2024-03-26  625  	ret = add_rtas_mem_range(mem_ranges);
f5f0da5a7b18fab Sourabh Jain 2024-03-26  626  	if (ret)
f5f0da5a7b18fab Sourabh Jain 2024-03-26  627  		goto out;
f5f0da5a7b18fab Sourabh Jain 2024-03-26  628  
f5f0da5a7b18fab Sourabh Jain 2024-03-26  629  	ret = add_opal_mem_range(mem_ranges);
f5f0da5a7b18fab Sourabh Jain 2024-03-26  630  	if (ret)
f5f0da5a7b18fab Sourabh Jain 2024-03-26  631  		goto out;
f5f0da5a7b18fab Sourabh Jain 2024-03-26  632  
f5f0da5a7b18fab Sourabh Jain 2024-03-26  633  	/* create a separate program header for the backup region */
f5f0da5a7b18fab Sourabh Jain 2024-03-26  634  	ret = add_mem_range(mem_ranges, BACKUP_SRC_START, BACKUP_SRC_SIZE);
f5f0da5a7b18fab Sourabh Jain 2024-03-26  635  	if (ret)
f5f0da5a7b18fab Sourabh Jain 2024-03-26  636  		goto out;
f5f0da5a7b18fab Sourabh Jain 2024-03-26  637  
f5f0da5a7b18fab Sourabh Jain 2024-03-26  638  	sort_memory_ranges(*mem_ranges, false);
f5f0da5a7b18fab Sourabh Jain 2024-03-26  639  out:
f5f0da5a7b18fab Sourabh Jain 2024-03-26  640  	if (ret)
f5f0da5a7b18fab Sourabh Jain 2024-03-26  641  		pr_err("Failed to setup crash memory ranges\n");
f5f0da5a7b18fab Sourabh Jain 2024-03-26  642  	return ret;
f5f0da5a7b18fab Sourabh Jain 2024-03-26  643  }
849599b702ef897 Sourabh Jain 2024-03-26  644  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

             reply	other threads:[~2026-04-07  4:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-07  4:03 kernel test robot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2025-12-22 17:44 arch/powerpc/kexec/ranges.c:612 get_crash_memory_ranges() warn: we never enter this loop kernel test robot

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=202604071051.dNysR5MD-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=error27@gmail.com \
    --cc=oe-kbuild@lists.linux.dev \
    /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