Skip to content

Use explicit int conversion in bootmem.c #546

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

Conversation

quangIO
Copy link

@quangIO quangIO commented Jul 9, 2024

Without the explicit cast, I encountered the following issue when using gcc 14 on Arch Linux:

❯ make -C tools/lkl
scripts/Makefile.asm-generic:25: redundant generic-y found in arch/lkl/include/uapi/asm/Kbuild: siginfo.h
scripts/Makefile.asm-generic:25: redundant generic-y found in arch/lkl/include/asm/Kbuild: atomic.h barrier.h bitops.h bug.h bugs.h cacheflush.h checksum.h compat.h current.h delay.h device.h div64.h emergency-restart.h exec.h ftrace.h futex.h hardirq.h hw_irq.h irq_regs.h irq_work.h kdebug.h kprobes.h linkage.h local.h local64.h mmiowb.h mmu.h module.h percpu.h pgalloc.h preempt.h sections.h serial.h simd.h switch_to.h timex.h tlbflush.h topology.h trace_clock.h uaccess.h unaligned.h vga.h word-at-a-time.h
  CALL    scripts/checksyscalls.sh
<stdin>:1519:2: warning: #warning syscall clone3 not implemented [-Wcpp]
  CC      arch/lkl/mm/bootmem.o
arch/lkl/mm/bootmem.c: In function ‘bootmem_init’:
arch/lkl/mm/bootmem.c:39:35: error: passing argument 1 of ‘virt_to_pfn’ makes pointer from integer without a cast [-Wint-conversion]
   39 |         max_low_pfn = virt_to_pfn(memory_end);
      |                                   ^~~~~~~~~~
      |                                   |
      |                                   long unsigned int
In file included from ./arch/lkl/include/asm/page.h:11,
                 from ./include/linux/mm_types_task.h:16,
                 from ./include/linux/mm_types.h:5,
                 from ./include/linux/mmzone.h:22,
                 from ./include/linux/gfp.h:7,
                 from ./include/linux/mm.h:7,
                 from ./include/linux/memblock.h:12,
                 from arch/lkl/mm/bootmem.c:2:
./include/asm-generic/page.h:77:53: note: expected ‘const void *’ but argument is of type ‘long unsigned int’
   77 | static inline unsigned long virt_to_pfn(const void *kaddr)
      |                                         ~~~~~~~~~~~~^~~~~
make[3]: *** [scripts/Makefile.build:243: arch/lkl/mm/bootmem.o] Error 1
make[2]: *** [scripts/Makefile.build:480: arch/lkl/mm] Error 2
make[1]: *** [Makefile:1917: .] Error 2
make: *** [Makefile:84: /home/lumi/dev/linux/tools/lkl/lib/lkl.o] Error 2

This addresses the compile issue when using gcc 14 on Arch Linux
Copy link

@ddiss ddiss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR. This was fixed via b133968 . I think this can be closed.

@quangIO quangIO closed this Mar 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants