All of lore.kernel.org
 help / color / mirror / Atom feed
* [linux-next:master 7570/7715] drivers/of/unittest.c:2939 unittest_unflatten_overlay_base() warn: should '1 << (((__builtin_constant_p((((((7 COPYING CREDITS Documentation Kbuild Kconfig LICENSES MAINTAINERS Makefile README arch block certs crypto drivers fs include init ipc kernel lib mm net samples scripts security sound tools usr virt 4) + 4) + 4) + 4)) - 1)) COPYING CREDITS Documentation Kbuild Kconfig LICENSES MAINTAINERS Makefile README arch block certs crypto drivers fs include init ipc kerne
@ 2020-11-25  4:02 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2020-11-25  4:02 UTC (permalink / raw)
  To: kbuild

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

CC: kbuild-all(a)lists.01.org
CC: Linux Memory Management List <linux-mm@kvack.org>
TO: Jakub Jelinek <jakub@redhat.com>
CC: "Peter Zijlstra (Intel)" <peterz@infradead.org>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: Linux Memory Management List <linux-mm@kvack.org>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   d9137320ac06f526fe3f9a3fdf07a3b14201068a
commit: 78b48e1e4e36424274e7c52a71057357e44c5473 [7570/7715] ilog2: Improve ilog2 for constant arguments
:::::: branch date: 21 hours ago
:::::: commit date: 22 hours ago
config: m68k-randconfig-m031-20201125 (attached as .config)
compiler: m68k-linux-gcc (GCC) 9.3.0

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

New smatch warnings:
drivers/of/unittest.c:2939 unittest_unflatten_overlay_base() warn: should '1 << (((__builtin_constant_p((((((7 * 4) + 4) + 4) + 4)) - 1)) ?((((((((7 * 4) + 4) + 4) + 4)) - 1) < 2) ?0:63 - __builtin_clzll((((((7 * 4) + 4) + 4) + 4)) - 1)):((4 <= 4)) ?__ilog2_u32((((((7 * 4) + 4) + 4) + 4)) - 1):__ilog2_u64((((((7 * 4) + 4) + 4) + 4)) - 1)) + 1)' be a 64 bit type?

Old smatch warnings:
drivers/of/unittest.c:3102 of_unittest_overlay_high_level() error: potentially dereferencing uninitialized 'overlay_base_symbols'.

vim +2939 drivers/of/unittest.c

0fa1c579349fdd9 Rob Herring  2018-01-05  2885  
81d0848fc8d2058 Frank Rowand 2017-04-25  2886  /*
81d0848fc8d2058 Frank Rowand 2017-04-25  2887   * Create base device tree for the overlay unittest.
81d0848fc8d2058 Frank Rowand 2017-04-25  2888   *
81d0848fc8d2058 Frank Rowand 2017-04-25  2889   * This is called from very early boot code.
81d0848fc8d2058 Frank Rowand 2017-04-25  2890   *
81d0848fc8d2058 Frank Rowand 2017-04-25  2891   * Do as much as possible the same way as done in __unflatten_device_tree
81d0848fc8d2058 Frank Rowand 2017-04-25  2892   * and other early boot steps for the normal FDT so that the overlay base
81d0848fc8d2058 Frank Rowand 2017-04-25  2893   * unflattened tree will have the same characteristics as the real tree
81d0848fc8d2058 Frank Rowand 2017-04-25  2894   * (such as having memory allocated by the early allocator).  The goal
81d0848fc8d2058 Frank Rowand 2017-04-25  2895   * is to test "the real thing" as much as possible, and test "test setup
81d0848fc8d2058 Frank Rowand 2017-04-25  2896   * code" as little as possible.
81d0848fc8d2058 Frank Rowand 2017-04-25  2897   *
81d0848fc8d2058 Frank Rowand 2017-04-25  2898   * Have to stop before resolving phandles, because that uses kmalloc.
81d0848fc8d2058 Frank Rowand 2017-04-25  2899   */
81d0848fc8d2058 Frank Rowand 2017-04-25  2900  void __init unittest_unflatten_overlay_base(void)
81d0848fc8d2058 Frank Rowand 2017-04-25  2901  {
81d0848fc8d2058 Frank Rowand 2017-04-25  2902  	struct overlay_info *info;
81d0848fc8d2058 Frank Rowand 2017-04-25  2903  	u32 data_size;
39a751a4cb7e479 Frank Rowand 2018-02-12  2904  	void *new_fdt;
81d0848fc8d2058 Frank Rowand 2017-04-25  2905  	u32 size;
160b1d4e4127f0e Frank Rowand 2018-10-04  2906  	int found = 0;
160b1d4e4127f0e Frank Rowand 2018-10-04  2907  	const char *overlay_name = "overlay_base";
160b1d4e4127f0e Frank Rowand 2018-10-04  2908  
160b1d4e4127f0e Frank Rowand 2018-10-04  2909  	for (info = overlays; info && info->name; info++) {
160b1d4e4127f0e Frank Rowand 2018-10-04  2910  		if (!strcmp(overlay_name, info->name)) {
160b1d4e4127f0e Frank Rowand 2018-10-04  2911  			found = 1;
160b1d4e4127f0e Frank Rowand 2018-10-04  2912  			break;
160b1d4e4127f0e Frank Rowand 2018-10-04  2913  		}
160b1d4e4127f0e Frank Rowand 2018-10-04  2914  	}
160b1d4e4127f0e Frank Rowand 2018-10-04  2915  	if (!found) {
160b1d4e4127f0e Frank Rowand 2018-10-04  2916  		pr_err("no overlay data for %s\n", overlay_name);
160b1d4e4127f0e Frank Rowand 2018-10-04  2917  		return;
160b1d4e4127f0e Frank Rowand 2018-10-04  2918  	}
81d0848fc8d2058 Frank Rowand 2017-04-25  2919  
81d0848fc8d2058 Frank Rowand 2017-04-25  2920  	info = &overlays[0];
81d0848fc8d2058 Frank Rowand 2017-04-25  2921  
81d0848fc8d2058 Frank Rowand 2017-04-25  2922  	if (info->expected_result != -9999) {
81d0848fc8d2058 Frank Rowand 2017-04-25  2923  		pr_err("No dtb 'overlay_base' to attach\n");
81d0848fc8d2058 Frank Rowand 2017-04-25  2924  		return;
81d0848fc8d2058 Frank Rowand 2017-04-25  2925  	}
81d0848fc8d2058 Frank Rowand 2017-04-25  2926  
81d0848fc8d2058 Frank Rowand 2017-04-25  2927  	data_size = info->dtb_end - info->dtb_begin;
81d0848fc8d2058 Frank Rowand 2017-04-25  2928  	if (!data_size) {
81d0848fc8d2058 Frank Rowand 2017-04-25  2929  		pr_err("No dtb 'overlay_base' to attach\n");
81d0848fc8d2058 Frank Rowand 2017-04-25  2930  		return;
81d0848fc8d2058 Frank Rowand 2017-04-25  2931  	}
81d0848fc8d2058 Frank Rowand 2017-04-25  2932  
81d0848fc8d2058 Frank Rowand 2017-04-25  2933  	size = fdt_totalsize(info->dtb_begin);
81d0848fc8d2058 Frank Rowand 2017-04-25  2934  	if (size != data_size) {
81d0848fc8d2058 Frank Rowand 2017-04-25  2935  		pr_err("dtb 'overlay_base' header totalsize != actual size");
81d0848fc8d2058 Frank Rowand 2017-04-25  2936  		return;
81d0848fc8d2058 Frank Rowand 2017-04-25  2937  	}
81d0848fc8d2058 Frank Rowand 2017-04-25  2938  
39a751a4cb7e479 Frank Rowand 2018-02-12 @2939  	new_fdt = dt_alloc_memory(size, roundup_pow_of_two(FDT_V17_SIZE));
39a751a4cb7e479 Frank Rowand 2018-02-12  2940  	if (!new_fdt) {
81d0848fc8d2058 Frank Rowand 2017-04-25  2941  		pr_err("alloc for dtb 'overlay_base' failed");
81d0848fc8d2058 Frank Rowand 2017-04-25  2942  		return;
81d0848fc8d2058 Frank Rowand 2017-04-25  2943  	}
81d0848fc8d2058 Frank Rowand 2017-04-25  2944  
39a751a4cb7e479 Frank Rowand 2018-02-12  2945  	memcpy(new_fdt, info->dtb_begin, size);
81d0848fc8d2058 Frank Rowand 2017-04-25  2946  
39a751a4cb7e479 Frank Rowand 2018-02-12  2947  	__unflatten_device_tree(new_fdt, NULL, &overlay_base_root,
0fa1c579349fdd9 Rob Herring  2018-01-05  2948  				dt_alloc_memory, true);
81d0848fc8d2058 Frank Rowand 2017-04-25  2949  }
81d0848fc8d2058 Frank Rowand 2017-04-25  2950  

:::::: The code at line 2939 was first introduced by commit
:::::: 39a751a4cb7e4798f0ce1169ec92de4a1aae39e3 of: change overlay apply input data from unflattened to FDT

:::::: TO: Frank Rowand <frank.rowand@sony.com>
:::::: CC: Frank Rowand <frowand.list@gmail.com>

---
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: 20674 bytes --]

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

only message in thread, other threads:[~2020-11-25  4:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-25  4:02 [linux-next:master 7570/7715] drivers/of/unittest.c:2939 unittest_unflatten_overlay_base() warn: should '1 << (((__builtin_constant_p((((((7 COPYING CREDITS Documentation Kbuild Kconfig LICENSES MAINTAINERS Makefile README arch block certs crypto drivers fs include init ipc kernel lib mm net samples scripts security sound tools usr virt 4) + 4) + 4) + 4)) - 1)) COPYING CREDITS Documentation Kbuild Kconfig LICENSES MAINTAINERS Makefile README arch block certs crypto drivers fs include init ipc kerne 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.