All of lore.kernel.org
 help / color / mirror / Atom feed
* [android-common:mirror-pa-android12-5.10-staging 1666/1718] drivers/misc/debug_kinfo.c:107:24: warning: format '%s' expects argument of type 'char but argument 3 has type 'const char
@ 2020-12-08  2:19 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2020-12-08  2:19 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 10691 bytes --]

tree:   https://android.googlesource.com/kernel/common mirror-pa-android12-5.10-staging
head:   0927548be1b3d5699f9b9849f90bb711ca481a07
commit: e643bd2cb1ae2cb28c905b5738dc76d9d6d76213 [1666/1718] ANDROID: misc: add debug-kinfo driver
config: arm64-randconfig-r003-20201208 (attached as .config)
compiler: aarch64-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        git remote add android-common https://android.googlesource.com/kernel/common
        git fetch --no-tags android-common mirror-pa-android12-5.10-staging
        git checkout e643bd2cb1ae2cb28c905b5738dc76d9d6d76213
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm64 

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

All warnings (new ones prefixed by >>):

   drivers/misc/debug_kinfo.c: In function 'build_info_set':
   drivers/misc/debug_kinfo.c:81:9: warning: passing argument 1 of 'vunmap' makes pointer from integer without a cast [-Wint-conversion]
      81 |  vunmap(all_info_addr);
         |         ^~~~~~~~~~~~~
         |         |
         |         phys_addr_t {aka long long unsigned int}
   In file included from drivers/misc/debug_kinfo.c:10:
   include/linux/vmalloc.h:124:32: note: expected 'const void *' but argument is of type 'phys_addr_t' {aka 'long long unsigned int'}
     124 | extern void vunmap(const void *addr);
         |                    ~~~~~~~~~~~~^~~~
   In file included from include/linux/device.h:15,
                    from include/linux/platform_device.h:13,
                    from drivers/misc/debug_kinfo.c:8:
   drivers/misc/debug_kinfo.c: In function 'debug_kinfo_probe':
>> drivers/misc/debug_kinfo.c:107:24: warning: format '%s' expects argument of type 'char *', but argument 3 has type 'const char **' [-Wformat=]
     107 |   dev_warn(&pdev->dev, "no such reserved mem of node name %s\n",
         |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/dev_printk.h:19:22: note: in definition of macro 'dev_fmt'
      19 | #define dev_fmt(fmt) fmt
         |                      ^~~
   drivers/misc/debug_kinfo.c:107:3: note: in expansion of macro 'dev_warn'
     107 |   dev_warn(&pdev->dev, "no such reserved mem of node name %s\n",
         |   ^~~~~~~~
   drivers/misc/debug_kinfo.c:107:60: note: format string is defined here
     107 |   dev_warn(&pdev->dev, "no such reserved mem of node name %s\n",
         |                                                           ~^
         |                                                            |
         |                                                            char *
   drivers/misc/debug_kinfo.c:127:16: warning: assignment to 'phys_addr_t' {aka 'long long unsigned int'} from 'void *' makes integer from pointer without a cast [-Wint-conversion]
     127 |  all_info_addr = rmem->priv;
         |                ^
   drivers/misc/debug_kinfo.c:143:41: warning: passing argument 1 of 'virt_to_phys' makes pointer from integer without a cast [-Wint-conversion]
     143 |  info->_relative_pa = (u64)virt_to_phys(kallsyms_relative_base);
         |                                         ^~~~~~~~~~~~~~~~~~~~~~
         |                                         |
         |                                         long unsigned int
   In file included from arch/arm64/include/asm/thread_info.h:17,
                    from include/linux/thread_info.h:38,
                    from arch/arm64/include/asm/preempt.h:5,
                    from include/linux/preempt.h:78,
                    from arch/arm64/include/asm/percpu.h:8,
                    from include/linux/irqflags.h:17,
                    from include/linux/rcupdate.h:26,
                    from include/linux/rculist.h:11,
                    from include/linux/pid.h:5,
                    from include/linux/sched.h:14,
                    from include/linux/ratelimit.h:6,
                    from include/linux/dev_printk.h:16,
                    from include/linux/device.h:15,
                    from include/linux/platform_device.h:13,
                    from drivers/misc/debug_kinfo.c:8:
   arch/arm64/include/asm/memory.h:276:61: note: expected 'const volatile void *' but argument is of type 'long unsigned int'
     276 | static inline phys_addr_t virt_to_phys(const volatile void *x)
         |                                        ~~~~~~~~~~~~~~~~~~~~~^

vim +107 drivers/misc/debug_kinfo.c

  > 10	#include <linux/vmalloc.h>
    11	#include <linux/module.h>
    12	#include <linux/of_address.h>
    13	#include <linux/of_reserved_mem.h>
    14	#include <linux/debug_kinfo.h>
    15	
    16	/*
    17	 * These will be re-linked against their real values
    18	 * during the second link stage.
    19	 */
    20	extern const unsigned long kallsyms_addresses[] __weak;
    21	extern const int kallsyms_offsets[] __weak;
    22	extern const u8 kallsyms_names[] __weak;
    23	
    24	/*
    25	 * Tell the compiler that the count isn't in the small data section if the arch
    26	 * has one (eg: FRV).
    27	 */
    28	extern const unsigned int kallsyms_num_syms __weak
    29	__section(".rodata");
    30	
    31	extern const unsigned long kallsyms_relative_base __weak
    32	__section(".rodata");
    33	
    34	extern const u8 kallsyms_token_table[] __weak;
    35	extern const u16 kallsyms_token_index[] __weak;
    36	
    37	extern const unsigned int kallsyms_markers[] __weak;
    38	
    39	static phys_addr_t all_info_addr;
    40	static u32 all_info_size;
    41	
    42	static void update_kernel_all_info(struct kernel_all_info *all_info)
    43	{
    44		int index;
    45		struct kernel_info *info;
    46		u32 *checksum_info;
    47	
    48		all_info->magic_number = DEBUG_KINFO_MAGIC;
    49		all_info->combined_checksum = 0;
    50	
    51		info = &(all_info->info);
    52		checksum_info = (u32 *)info;
    53		for (index = 0; index < sizeof(*info) / sizeof(u32); index++)
    54			all_info->combined_checksum ^= checksum_info[index];
    55	}
    56	
    57	static int build_info_set(const char *str, const struct kernel_param *kp)
    58	{
    59		struct kernel_all_info *all_info;
    60		size_t build_info_size;
    61		int ret = 0;
    62	
    63		if (all_info_addr == 0 || all_info_size == 0) {
    64			ret = -EPERM;
    65			goto Exit;
    66		}
    67	
    68		all_info = (struct kernel_all_info *)all_info_addr;
    69		build_info_size = sizeof(all_info->info.build_info);
    70	
    71		memcpy(&all_info->info.build_info, str, min(build_info_size - 1, strlen(str)));
    72		update_kernel_all_info(all_info);
    73	
    74		if (strlen(str) > build_info_size) {
    75			pr_warn("%s: Build info buffer (len: %zd) can't hold entire string '%s'\n",
    76					__func__, build_info_size, str);
    77			ret = -ENOMEM;
    78		}
    79	
    80	Exit:
    81		vunmap(all_info_addr);
    82		return ret;
    83	}
    84	
    85	static const struct kernel_param_ops build_info_op = {
    86		.set = build_info_set,
    87	};
    88	
    89	module_param_cb(build_info, &build_info_op, NULL, 0200);
    90	MODULE_PARM_DESC(build_info, "Write build info to field 'build_info' of debug kinfo.");
    91	
    92	static int debug_kinfo_probe(struct platform_device *pdev)
    93	{
    94		struct device_node *mem_region;
    95		struct reserved_mem *rmem;
    96		struct kernel_all_info *all_info;
    97		struct kernel_info *info;
    98	
    99		mem_region = of_parse_phandle(pdev->dev.of_node, "memory-region", 0);
   100		if (!mem_region) {
   101			dev_warn(&pdev->dev, "no such memory-region\n");
   102			return 0;
   103		}
   104	
   105		rmem = of_reserved_mem_lookup(mem_region);
   106		if (!rmem) {
 > 107			dev_warn(&pdev->dev, "no such reserved mem of node name %s\n",
   108					&pdev->dev.of_node->name);
   109			return 0;
   110		}
   111	
   112		/* Deferred until dss.ko(dpm.o) and debug-snapshot-debug-kinfo.ko are ready */
   113		if (!rmem->priv) {
   114			return -EPROBE_DEFER;
   115		}
   116	
   117		if (!rmem->base || !rmem->size) {
   118			dev_warn(&pdev->dev, "unexpected reserved memory\n");
   119			return 0;
   120		}
   121	
   122		if (rmem->size < sizeof(struct kernel_all_info)) {
   123			dev_warn(&pdev->dev, "unexpected reserved memory size\n");
   124			return 0;
   125		}
   126	
   127		all_info_addr = rmem->priv;
   128		all_info_size = rmem->size;
   129	
   130		memset((void *)all_info_addr, 0, all_info_size);
   131		all_info = (struct kernel_all_info *)all_info_addr;
   132		info = &(all_info->info);
   133		info->enabled_all = IS_ENABLED(CONFIG_KALLSYMS_ALL);
   134		info->enabled_base_relative = IS_ENABLED(CONFIG_KALLSYMS_BASE_RELATIVE);
   135		info->enabled_absolute_percpu = IS_ENABLED(CONFIG_KALLSYMS_ABSOLUTE_PERCPU);
   136		info->enabled_cfi_clang = IS_ENABLED(CONFIG_CFI_CLANG);
   137		info->num_syms = kallsyms_num_syms;
   138		info->name_len = KSYM_NAME_LEN;
   139		info->bit_per_long = BITS_PER_LONG;
   140		info->module_name_len = MODULE_NAME_LEN;
   141		info->symbol_len = KSYM_SYMBOL_LEN;
   142		info->_addresses_pa = (u64)virt_to_phys(kallsyms_addresses);
   143		info->_relative_pa = (u64)virt_to_phys(kallsyms_relative_base);
   144		info->_stext_pa = (u64)virt_to_phys(_stext);
   145		info->_etext_pa = (u64)virt_to_phys(_etext);
   146		info->_sinittext_pa = (u64)virt_to_phys(_sinittext);
   147		info->_einittext_pa = (u64)virt_to_phys(_einittext);
   148		info->_end_pa = (u64)virt_to_phys(_end);
   149		info->_offsets_pa = (u64)virt_to_phys(kallsyms_offsets);
   150		info->_names_pa = (u64)virt_to_phys(kallsyms_names);
   151		info->_token_table_pa = (u64)virt_to_phys(kallsyms_token_table);
   152		info->_token_index_pa = (u64)virt_to_phys(kallsyms_token_index);
   153		info->_markers_pa = (u64)virt_to_phys(kallsyms_markers);
   154		info->thread_size = THREAD_SIZE;
   155		info->swapper_pg_dir_pa = (u64)virt_to_phys(swapper_pg_dir);
   156		strlcpy(info->last_uts_release, init_utsname()->release, sizeof(info->last_uts_release));
   157	
   158		update_kernel_all_info(all_info);
   159	
   160		return 0;
   161	}
   162	

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

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 39912 bytes --]

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

only message in thread, other threads:[~2020-12-08  2:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-08  2:19 [android-common:mirror-pa-android12-5.10-staging 1666/1718] drivers/misc/debug_kinfo.c:107:24: warning: format '%s' expects argument of type 'char but argument 3 has type 'const char kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.