Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
* [ardb:arm64-combine-module-section-allocations 1/1] kernel/module/main.c:2826:21: warning: comparison between pointer and integer ('enum iter_type (*)(const struct iov_iter *)' and 'int')
@ 2026-08-19 20:55 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2026-08-19 20:55 UTC (permalink / raw)
  To: Ard Biesheuvel; +Cc: llvm, oe-kbuild-all

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/ardb/linux.git arm64-combine-module-section-allocations
head:   eaa00409fb18efd5ba35159657893d158d91faa4
commit: eaa00409fb18efd5ba35159657893d158d91faa4 [1/1] module: Permit module section allocations to be combined
config: x86_64-kexec (https://download.01.org/0day-ci/archive/20260819/202608192253.Q3oNYow4-lkp@intel.com/config)
compiler: clang version 22.1.8 (https://github.com/llvm/llvm-project ca7933e47d3a3451d81e72ac174dcb5aa28b59d1)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260819/202608192253.Q3oNYow4-lkp@intel.com/reproduce)

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
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202608192253.Q3oNYow4-lkp@intel.com/

All warnings (new ones prefixed by >>):

   kernel/module/main.c:2826:7: error: use of undeclared identifier 'provider_type'; did you mean 'iov_iter_type'?
    2826 |                 if (provider_type == MOD_INVALID)
         |                     ^~~~~~~~~~~~~
         |                     iov_iter_type
   include/linux/uio.h:110:30: note: 'iov_iter_type' declared here
     110 | static inline enum iter_type iov_iter_type(const struct iov_iter *i)
         |                              ^
>> kernel/module/main.c:2826:21: warning: comparison between pointer and integer ('enum iter_type (*)(const struct iov_iter *)' and 'int') [-Wpointer-integer-compare]
    2826 |                 if (provider_type == MOD_INVALID)
         |                     ~~~~~~~~~~~~~ ^  ~~~~~~~~~~~
   1 warning and 1 error generated.


vim +2826 kernel/module/main.c

  2800	
  2801	static int move_module(struct module *mod, struct load_info *info)
  2802	{
  2803		int i, ret;
  2804		enum mod_mem_type t = MOD_MEM_NUM_TYPES;
  2805		bool codetag_section_found = false;
  2806	
  2807		for_each_mod_mem_type(type) {
  2808			if (!mod->mem[type].size) {
  2809				mod->mem[type].base = NULL;
  2810				continue;
  2811			}
  2812	
  2813			if (mod->mem[type].alloc_provider != MOD_INVALID)
  2814				continue;
  2815	
  2816			ret = module_memory_alloc(mod, type);
  2817			if (ret) {
  2818				t = type;
  2819				goto out_err;
  2820			}
  2821		}
  2822	
  2823		for_each_mod_mem_type(type) {
  2824			auto p_type = mod->mem[type].alloc_provider;
  2825	
> 2826			if (provider_type == MOD_INVALID)
  2827				continue;
  2828	
  2829			mod->mem[p_type].size -= mod->mem[type].size;
  2830			mod->mem[type].base = mod->mem[p_type].base +
  2831					      mod->mem[p_type].size;
  2832	
  2833			mod->mem[type].is_rox = mod->mem[p_type].is_rox;
  2834		}
  2835	
  2836		/* Transfer each section which specifies SHF_ALLOC */
  2837		pr_debug("Final section addresses for %s:\n", mod->name);
  2838		for (i = 0; i < info->hdr->e_shnum; i++) {
  2839			void *dest;
  2840			Elf_Shdr *shdr = &info->sechdrs[i];
  2841			const char *sname;
  2842	
  2843			if (!(shdr->sh_flags & SHF_ALLOC))
  2844				continue;
  2845	
  2846			sname = info->secstrings + shdr->sh_name;
  2847			/*
  2848			 * Load codetag sections separately as they might still be used
  2849			 * after module unload.
  2850			 */
  2851			if (codetag_needs_module_section(mod, sname, shdr->sh_size)) {
  2852				dest = codetag_alloc_module_section(mod, sname, shdr->sh_size,
  2853						arch_mod_section_prepend(mod, i), shdr->sh_addralign);
  2854				if (WARN_ON(!dest)) {
  2855					ret = -EINVAL;
  2856					goto out_err;
  2857				}
  2858				if (IS_ERR(dest)) {
  2859					ret = PTR_ERR(dest);
  2860					goto out_err;
  2861				}
  2862				codetag_section_found = true;
  2863			} else {
  2864				enum mod_mem_type type = shdr->sh_entsize >> SH_ENTSIZE_TYPE_SHIFT;
  2865				unsigned long offset = shdr->sh_entsize & SH_ENTSIZE_OFFSET_MASK;
  2866	
  2867				dest = mod->mem[type].base + offset;
  2868			}
  2869	
  2870			if (shdr->sh_type != SHT_NOBITS) {
  2871				/*
  2872				 * Our ELF checker already validated this, but let's
  2873				 * be pedantic and make the goal clearer. We actually
  2874				 * end up copying over all modifications made to the
  2875				 * userspace copy of the entire struct module.
  2876				 */
  2877				if (i == info->index.mod &&
  2878				   (WARN_ON_ONCE(shdr->sh_size != sizeof(struct module)))) {
  2879					ret = -ENOEXEC;
  2880					goto out_err;
  2881				}
  2882				memcpy(dest, (void *)shdr->sh_addr, shdr->sh_size);
  2883			}
  2884			/*
  2885			 * Update the userspace copy's ELF section address to point to
  2886			 * our newly allocated memory as a pure convenience so that
  2887			 * users of info can keep taking advantage and using the newly
  2888			 * minted official memory area.
  2889			 */
  2890			shdr->sh_addr = (unsigned long)dest;
  2891			pr_debug("\t0x%lx 0x%.8lx %s\n", (long)shdr->sh_addr,
  2892				 (long)shdr->sh_size, info->secstrings + shdr->sh_name);
  2893		}
  2894	
  2895		return 0;
  2896	out_err:
  2897		module_memory_restore_rox(mod);
  2898		while (t--)
  2899			module_memory_free(mod, t);
  2900		if (codetag_section_found)
  2901			codetag_free_module_sections(mod);
  2902	
  2903		return ret;
  2904	}
  2905	

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-08-19 20:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-19 20:55 [ardb:arm64-combine-module-section-allocations 1/1] kernel/module/main.c:2826:21: warning: comparison between pointer and integer ('enum iter_type (*)(const struct iov_iter *)' and 'int') kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox