CC: [email protected] CC: [email protected] TO: Jakub Jelinek <[email protected]> CC: "Peter Zijlstra (Intel)" <[email protected]> CC: Andrew Morton <[email protected]> CC: Linux Memory Management List <[email protected]>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 64570fbc14f8d7cb3fe3995f20e26bc25ce4b2cc commit: 2f78788b55baa3410b1ec91a576286abe1ad4d6a ilog2: improve ilog2 for constant arguments date: 10 months ago :::::: branch date: 26 hours ago :::::: commit date: 10 months ago config: microblaze-randconfig-m031-20211011 (attached as .config) compiler: microblaze-linux-gcc (GCC) 11.2.0 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <[email protected]> Reported-by: Dan Carpenter <[email protected]> New smatch warnings: drivers/of/unittest.c:2959 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:829 of_unittest_changeset() error: potential null dereference 'n1'. (__of_node_dup returns null) drivers/of/unittest.c:830 of_unittest_changeset() error: potential null dereference 'n2'. (__of_node_dup returns null) drivers/of/unittest.c:831 of_unittest_changeset() error: potential null dereference 'n21'. (__of_node_dup returns null) drivers/of/unittest.c:3122 of_unittest_overlay_high_level() error: potentially dereferencing uninitialized 'overlay_base_symbols'. vim +2959 drivers/of/unittest.c 0fa1c579349fdd Rob Herring 2018-01-05 2905 81d0848fc8d205 Frank Rowand 2017-04-25 2906 /* 81d0848fc8d205 Frank Rowand 2017-04-25 2907 * Create base device tree for the overlay unittest. 81d0848fc8d205 Frank Rowand 2017-04-25 2908 * 81d0848fc8d205 Frank Rowand 2017-04-25 2909 * This is called from very early boot code. 81d0848fc8d205 Frank Rowand 2017-04-25 2910 * 81d0848fc8d205 Frank Rowand 2017-04-25 2911 * Do as much as possible the same way as done in __unflatten_device_tree 81d0848fc8d205 Frank Rowand 2017-04-25 2912 * and other early boot steps for the normal FDT so that the overlay base 81d0848fc8d205 Frank Rowand 2017-04-25 2913 * unflattened tree will have the same characteristics as the real tree 81d0848fc8d205 Frank Rowand 2017-04-25 2914 * (such as having memory allocated by the early allocator). The goal 81d0848fc8d205 Frank Rowand 2017-04-25 2915 * is to test "the real thing" as much as possible, and test "test setup 81d0848fc8d205 Frank Rowand 2017-04-25 2916 * code" as little as possible. 81d0848fc8d205 Frank Rowand 2017-04-25 2917 * 81d0848fc8d205 Frank Rowand 2017-04-25 2918 * Have to stop before resolving phandles, because that uses kmalloc. 81d0848fc8d205 Frank Rowand 2017-04-25 2919 */ 81d0848fc8d205 Frank Rowand 2017-04-25 2920 void __init unittest_unflatten_overlay_base(void) 81d0848fc8d205 Frank Rowand 2017-04-25 2921 { 81d0848fc8d205 Frank Rowand 2017-04-25 2922 struct overlay_info *info; 81d0848fc8d205 Frank Rowand 2017-04-25 2923 u32 data_size; 39a751a4cb7e47 Frank Rowand 2018-02-12 2924 void *new_fdt; 81d0848fc8d205 Frank Rowand 2017-04-25 2925 u32 size; 160b1d4e4127f0 Frank Rowand 2018-10-04 2926 int found = 0; 160b1d4e4127f0 Frank Rowand 2018-10-04 2927 const char *overlay_name = "overlay_base"; 160b1d4e4127f0 Frank Rowand 2018-10-04 2928 160b1d4e4127f0 Frank Rowand 2018-10-04 2929 for (info = overlays; info && info->name; info++) { 160b1d4e4127f0 Frank Rowand 2018-10-04 2930 if (!strcmp(overlay_name, info->name)) { 160b1d4e4127f0 Frank Rowand 2018-10-04 2931 found = 1; 160b1d4e4127f0 Frank Rowand 2018-10-04 2932 break; 160b1d4e4127f0 Frank Rowand 2018-10-04 2933 } 160b1d4e4127f0 Frank Rowand 2018-10-04 2934 } 160b1d4e4127f0 Frank Rowand 2018-10-04 2935 if (!found) { 160b1d4e4127f0 Frank Rowand 2018-10-04 2936 pr_err("no overlay data for %s\n", overlay_name); 160b1d4e4127f0 Frank Rowand 2018-10-04 2937 return; 160b1d4e4127f0 Frank Rowand 2018-10-04 2938 } 81d0848fc8d205 Frank Rowand 2017-04-25 2939 81d0848fc8d205 Frank Rowand 2017-04-25 2940 info = &overlays[0]; 81d0848fc8d205 Frank Rowand 2017-04-25 2941 81d0848fc8d205 Frank Rowand 2017-04-25 2942 if (info->expected_result != -9999) { 81d0848fc8d205 Frank Rowand 2017-04-25 2943 pr_err("No dtb 'overlay_base' to attach\n"); 81d0848fc8d205 Frank Rowand 2017-04-25 2944 return; 81d0848fc8d205 Frank Rowand 2017-04-25 2945 } 81d0848fc8d205 Frank Rowand 2017-04-25 2946 81d0848fc8d205 Frank Rowand 2017-04-25 2947 data_size = info->dtb_end - info->dtb_begin; 81d0848fc8d205 Frank Rowand 2017-04-25 2948 if (!data_size) { 81d0848fc8d205 Frank Rowand 2017-04-25 2949 pr_err("No dtb 'overlay_base' to attach\n"); 81d0848fc8d205 Frank Rowand 2017-04-25 2950 return; 81d0848fc8d205 Frank Rowand 2017-04-25 2951 } 81d0848fc8d205 Frank Rowand 2017-04-25 2952 81d0848fc8d205 Frank Rowand 2017-04-25 2953 size = fdt_totalsize(info->dtb_begin); 81d0848fc8d205 Frank Rowand 2017-04-25 2954 if (size != data_size) { 81d0848fc8d205 Frank Rowand 2017-04-25 2955 pr_err("dtb 'overlay_base' header totalsize != actual size"); 81d0848fc8d205 Frank Rowand 2017-04-25 2956 return; 81d0848fc8d205 Frank Rowand 2017-04-25 2957 } 81d0848fc8d205 Frank Rowand 2017-04-25 2958 39a751a4cb7e47 Frank Rowand 2018-02-12 @2959 new_fdt = dt_alloc_memory(size, roundup_pow_of_two(FDT_V17_SIZE)); 39a751a4cb7e47 Frank Rowand 2018-02-12 2960 if (!new_fdt) { 81d0848fc8d205 Frank Rowand 2017-04-25 2961 pr_err("alloc for dtb 'overlay_base' failed"); 81d0848fc8d205 Frank Rowand 2017-04-25 2962 return; 81d0848fc8d205 Frank Rowand 2017-04-25 2963 } 81d0848fc8d205 Frank Rowand 2017-04-25 2964 39a751a4cb7e47 Frank Rowand 2018-02-12 2965 memcpy(new_fdt, info->dtb_begin, size); 81d0848fc8d205 Frank Rowand 2017-04-25 2966 39a751a4cb7e47 Frank Rowand 2018-02-12 2967 __unflatten_device_tree(new_fdt, NULL, &overlay_base_root, 0fa1c579349fdd Rob Herring 2018-01-05 2968 dt_alloc_memory, true); 81d0848fc8d205 Frank Rowand 2017-04-25 2969 } 81d0848fc8d205 Frank Rowand 2017-04-25 2970 :::::: The code at line 2959 was first introduced by commit :::::: 39a751a4cb7e4798f0ce1169ec92de4a1aae39e3 of: change overlay apply input data from unflattened to FDT :::::: TO: Frank Rowand <[email protected]> :::::: CC: Frank Rowand <[email protected]> --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/[email protected]
.config.gz
Description: application/gzip
_______________________________________________ kbuild mailing list -- [email protected] To unsubscribe send an email to [email protected]
