[android-common:main-16k-gs-shusky-5.15 35/35] drivers/cma/mm/mem_phys_layout.c:86:25: warning: cast from pointer to integer of different size

kernel test robot <[email protected]> Tue, 28 Jul 2026 17:04:54 +0800
Newsgroups dev.linux.lists.oe-kbuild-all
Message-ID <[email protected]>
Hi Juan,

FYI, the error/warning still remains.

tree:   https://android.googlesource.com/kernel/common main-16k-gs-shusky-5.15
head:   d0ed0375a65ca817f907805e163e103822348f02
commit: 2a9a81f53ac75526c6b30e27ee151e978b0830c4 [35/35] ANDROID: mm: Use vmemmap to get the address of the first page
config: i386-randconfig-005-20260728 (https://download.01.org/0day-ci/archive/20260728/[email protected]/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260728/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

   In file included from include/asm-generic/bug.h:22,
                    from arch/x86/include/asm/bug.h:86,
                    from include/linux/bug.h:5,
                    from include/linux/mmdebug.h:5,
                    from include/linux/mm.h:9,
                    from include/linux/memblock.h:13,
                    from drivers/cma/mm/mem_phys_layout.c:14:
   drivers/cma/mm/mem_phys_layout.c: In function 'print_pfn_start_address':
>> drivers/cma/mm/mem_phys_layout.c:86:25: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
      86 |                         (unsigned long long)first_page);
         |                         ^
   include/linux/printk.h:422:33: note: in definition of macro 'printk_index_wrap'
     422 |                 _p_func(_fmt, ##__VA_ARGS__);                           \
         |                                 ^~~~~~~~~~~
   include/linux/printk.h:523:9: note: in expansion of macro 'printk'
     523 |         printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
         |         ^~~~~~
   drivers/cma/mm/mem_phys_layout.c:85:9: note: in expansion of macro 'pr_info'
      85 |         pr_info("First struct page starts at: pfn_to_page(0) [mem %#010Lx]\n",
         |         ^~~~~~~


vim +86 drivers/cma/mm/mem_phys_layout.c

    12	
    13	#include <linux/init.h>
  > 14	#include <linux/memblock.h>
    15	#include <linux/module.h>
    16	#include <linux/nodemask.h>
    17	#include <linux/pfn.h>
    18	#include <linux/printk.h>
    19	#include <linux/types.h>
    20	
    21	/*
    22	 * Print the start and end of the RAM as well as the size.
    23	 *
    24	 * This information is found in the device tree.
    25	 *
    26	 *   memory@40000000 {
    27	 *       reg = <0x00 0x40000000 0x02 0x00>;
    28	 *       device_type = "memory";
    29	 *   };
    30	 */
    31	static void print_ram_info(void)
    32	{
    33		phys_addr_t start_addr = memblock_start_of_DRAM();
    34		phys_addr_t end_addr = memblock_end_of_DRAM();
    35		phys_addr_t mem_size = memblock_phys_mem_size();
    36		// What does the reserved memory includes.
    37		phys_addr_t reserved_size = memblock_reserved_size();
    38	
    39		pr_info("    start_addr:    %10llu == %#010Lx", (u64)start_addr, (u64)start_addr);
    40		pr_info("    end_addr:      %10llu == %#010Lx", (u64)end_addr, (u64)end_addr);
    41		pr_info("    mem_size:      %10llu == %#010Lx", (u64)mem_size, (u64)mem_size);
    42		pr_info("    reserved_size: %10llu == %#010Lx", (u64)reserved_size, (u64)reserved_size);
    43	}
    44	
    45	// Prints the node information in:
    46	//
    47	//     struct pglist_data *node_data;
    48	//
    49	// It uses NODE_DATA to access node_data.
    50	//
    51	//     #define NODE_DATA(nid)		(node_data[(nid)])
    52	static void print_node_data(void)
    53	{
    54		// Note: NUMA nodes are configured in the device tree.
    55		int nodeId;
    56		unsigned long phys_pages = get_num_physpages();
    57	
    58		for_each_online_node(nodeId) {
    59			// Number of Physical pages including holes in the node.
    60			uint64_t num_spanned_pages = NODE_DATA(nodeId)->node_spanned_pages;
    61			// Number of Physical pages in the node.
    62			uint64_t num_present_pages = NODE_DATA(nodeId)->node_present_pages;
    63			uint64_t start_pfn = NODE_DATA(nodeId)->node_start_pfn;
    64			uint64_t end_pfn = NODE_DATA(nodeId)->node_start_pfn + num_spanned_pages;
    65	
    66			pr_info("Node %d", nodeId);
    67			pr_info("    Page frames numbers (range): [pfn %#010Lx-%#010Lx)\n",
    68					start_pfn, end_pfn);
    69			pr_info("    Number of Page Spanned pages (includes holes): %#010Lx : %llu\n",
    70					num_spanned_pages, num_spanned_pages);
    71			pr_info("    Number of Page Present pages:                  %#010Lx : %llu",
    72					num_present_pages, num_present_pages);
    73			pr_info("    Number of Page frames (end_pfn - start_pfn):   %#010Lx : %llu",
    74					end_pfn - start_pfn, end_pfn - start_pfn);
    75		}
    76	
    77		pr_info("Total number of Physical Pages in all nodes (DO NOT include holes) %lu",
    78				phys_pages);
    79	}
    80	
    81	static void print_pfn_start_address(void)
    82	{
    83		struct page *first_page = pfn_to_page(0);
    84	
    85		pr_info("First struct page starts at: pfn_to_page(0) [mem %#010Lx]\n",
  > 86				(unsigned long long)first_page);
    87	

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