CC: kbuild-...@lists.01.org In-Reply-To: <20210407205110.2173976-1-frowand.l...@gmail.com> References: <20210407205110.2173976-1-frowand.l...@gmail.com> TO: frowand.l...@gmail.com TO: Rob Herring <robh...@kernel.org> TO: Guenter Roeck <li...@roeck-us.net> CC: Pantelis Antoniou <pantelis.anton...@konsulko.com> CC: devicet...@vger.kernel.org CC: Geert Uytterhoeven <geert+rene...@glider.be> CC: linux-ker...@vger.kernel.org
Hi, I love your patch! Perhaps something to improve: [auto build test WARNING on robh/for-next] [also build test WARNING on v5.12-rc6 next-20210407] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/frowand-list-gmail-com/of-unittest-overlay-ensure-proper-alignment-of-copied-FDT/20210408-045317 base: https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next :::::: branch date: 9 hours ago :::::: commit date: 9 hours ago config: microblaze-randconfig-m031-20210407 (attached as .config) compiler: microblaze-linux-gcc (GCC) 9.3.0 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <l...@intel.com> Reported-by: Dan Carpenter <dan.carpen...@oracle.com> New smatch warnings: drivers/of/unittest.c:1434 unittest_data_add() warn: overwrite may leak 'unittest_data' Old smatch warnings: drivers/of/unittest.c:2964 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? drivers/of/unittest.c:3127 of_unittest_overlay_high_level() error: potentially dereferencing uninitialized 'overlay_base_symbols'. vim +/unittest_data +1434 drivers/of/unittest.c ae9304c9d31117 drivers/of/selftest.c Gaurav Minocha 2014-07-16 1404 ae9304c9d31117 drivers/of/selftest.c Gaurav Minocha 2014-07-16 1405 /** 9697a5595ece52 drivers/of/unittest.c Wang Long 2015-03-11 1406 * unittest_data_add - Reads, copies data from ae9304c9d31117 drivers/of/selftest.c Gaurav Minocha 2014-07-16 1407 * linked tree and attaches it to the live tree ae9304c9d31117 drivers/of/selftest.c Gaurav Minocha 2014-07-16 1408 */ 9697a5595ece52 drivers/of/unittest.c Wang Long 2015-03-11 1409 static int __init unittest_data_add(void) ae9304c9d31117 drivers/of/selftest.c Gaurav Minocha 2014-07-16 1410 { 9697a5595ece52 drivers/of/unittest.c Wang Long 2015-03-11 1411 void *unittest_data; 9697a5595ece52 drivers/of/unittest.c Wang Long 2015-03-11 1412 struct device_node *unittest_data_node, *np; c8547119ce54ef drivers/of/unittest.c Frank Rowand 2015-03-14 1413 /* c8547119ce54ef drivers/of/unittest.c Frank Rowand 2015-03-14 1414 * __dtb_testcases_begin[] and __dtb_testcases_end[] are magically c8547119ce54ef drivers/of/unittest.c Frank Rowand 2015-03-14 1415 * created by cmd_dt_S_dtb in scripts/Makefile.lib c8547119ce54ef drivers/of/unittest.c Frank Rowand 2015-03-14 1416 */ ae9304c9d31117 drivers/of/selftest.c Gaurav Minocha 2014-07-16 1417 extern uint8_t __dtb_testcases_begin[]; ae9304c9d31117 drivers/of/selftest.c Gaurav Minocha 2014-07-16 1418 extern uint8_t __dtb_testcases_end[]; 7a18fbf9013a19 drivers/of/unittest.c Frank Rowand 2021-04-07 1419 u32 size = __dtb_testcases_end - __dtb_testcases_begin; 2eb46da2a760e5 drivers/of/selftest.c Grant Likely 2014-10-02 1420 int rc; ae9304c9d31117 drivers/of/selftest.c Gaurav Minocha 2014-07-16 1421 b951f9dc7f25fc drivers/of/selftest.c Gaurav Minocha 2014-07-26 1422 if (!size) { ae9304c9d31117 drivers/of/selftest.c Gaurav Minocha 2014-07-16 1423 pr_warn("%s: No testcase data to attach; not running tests\n", ae9304c9d31117 drivers/of/selftest.c Gaurav Minocha 2014-07-16 1424 __func__); ae9304c9d31117 drivers/of/selftest.c Gaurav Minocha 2014-07-16 1425 return -ENODATA; ae9304c9d31117 drivers/of/selftest.c Gaurav Minocha 2014-07-16 1426 } ae9304c9d31117 drivers/of/selftest.c Gaurav Minocha 2014-07-16 1427 ae9304c9d31117 drivers/of/selftest.c Gaurav Minocha 2014-07-16 1428 /* creating copy */ 7a18fbf9013a19 drivers/of/unittest.c Frank Rowand 2021-04-07 1429 size += FDT_ALIGN_SIZE; 7a18fbf9013a19 drivers/of/unittest.c Frank Rowand 2021-04-07 1430 unittest_data = kmalloc(size, GFP_KERNEL); 2a656cb5a4a347 drivers/of/unittest.c Geert Uytterhoeven 2019-05-02 1431 if (!unittest_data) ae9304c9d31117 drivers/of/selftest.c Gaurav Minocha 2014-07-16 1432 return -ENOMEM; 2a656cb5a4a347 drivers/of/unittest.c Geert Uytterhoeven 2019-05-02 1433 7a18fbf9013a19 drivers/of/unittest.c Frank Rowand 2021-04-07 @1434 unittest_data = PTR_ALIGN(unittest_data, FDT_ALIGN_SIZE); 7a18fbf9013a19 drivers/of/unittest.c Frank Rowand 2021-04-07 1435 memcpy(unittest_data, __dtb_testcases_begin, size); 7a18fbf9013a19 drivers/of/unittest.c Frank Rowand 2021-04-07 1436 c4263233f30e72 drivers/of/unittest.c Gavin Shan 2016-05-03 1437 of_fdt_unflatten_tree(unittest_data, NULL, &unittest_data_node); 9697a5595ece52 drivers/of/unittest.c Wang Long 2015-03-11 1438 if (!unittest_data_node) { b951f9dc7f25fc drivers/of/selftest.c Gaurav Minocha 2014-07-26 1439 pr_warn("%s: No tree to attach; not running tests\n", __func__); e13de8fe0d6a51 drivers/of/unittest.c Navid Emamdoost 2019-10-04 1440 kfree(unittest_data); b951f9dc7f25fc drivers/of/selftest.c Gaurav Minocha 2014-07-26 1441 return -ENODATA; b951f9dc7f25fc drivers/of/selftest.c Gaurav Minocha 2014-07-26 1442 } f948d6d8b792bb drivers/of/unittest.c Frank Rowand 2017-10-17 1443 f948d6d8b792bb drivers/of/unittest.c Frank Rowand 2017-10-17 1444 /* 39a751a4cb7e47 drivers/of/unittest.c Frank Rowand 2018-02-12 1445 * This lock normally encloses of_resolve_phandles() f948d6d8b792bb drivers/of/unittest.c Frank Rowand 2017-10-17 1446 */ f948d6d8b792bb drivers/of/unittest.c Frank Rowand 2017-10-17 1447 of_overlay_mutex_lock(); f948d6d8b792bb drivers/of/unittest.c Frank Rowand 2017-10-17 1448 9697a5595ece52 drivers/of/unittest.c Wang Long 2015-03-11 1449 rc = of_resolve_phandles(unittest_data_node); 2eb46da2a760e5 drivers/of/selftest.c Grant Likely 2014-10-02 1450 if (rc) { 2eb46da2a760e5 drivers/of/selftest.c Grant Likely 2014-10-02 1451 pr_err("%s: Failed to resolve phandles (rc=%i)\n", __func__, rc); f948d6d8b792bb drivers/of/unittest.c Frank Rowand 2017-10-17 1452 of_overlay_mutex_unlock(); 2eb46da2a760e5 drivers/of/selftest.c Grant Likely 2014-10-02 1453 return -EINVAL; 2eb46da2a760e5 drivers/of/selftest.c Grant Likely 2014-10-02 1454 } b951f9dc7f25fc drivers/of/selftest.c Gaurav Minocha 2014-07-26 1455 5063e25a302e6a drivers/of/selftest.c Grant Likely 2014-10-03 1456 if (!of_root) { 9697a5595ece52 drivers/of/unittest.c Wang Long 2015-03-11 1457 of_root = unittest_data_node; b951f9dc7f25fc drivers/of/selftest.c Gaurav Minocha 2014-07-26 1458 for_each_of_allnodes(np) b951f9dc7f25fc drivers/of/selftest.c Gaurav Minocha 2014-07-26 1459 __of_attach_node_sysfs(np); b951f9dc7f25fc drivers/of/selftest.c Gaurav Minocha 2014-07-26 1460 of_aliases = of_find_node_by_path("/aliases"); b951f9dc7f25fc drivers/of/selftest.c Gaurav Minocha 2014-07-26 1461 of_chosen = of_find_node_by_path("/chosen"); f948d6d8b792bb drivers/of/unittest.c Frank Rowand 2017-10-17 1462 of_overlay_mutex_unlock(); b951f9dc7f25fc drivers/of/selftest.c Gaurav Minocha 2014-07-26 1463 return 0; b951f9dc7f25fc drivers/of/selftest.c Gaurav Minocha 2014-07-26 1464 } ae9304c9d31117 drivers/of/selftest.c Gaurav Minocha 2014-07-16 1465 0ac1743979408a drivers/of/unittest.c Frank Rowand 2020-02-20 1466 EXPECT_BEGIN(KERN_INFO, 0ac1743979408a drivers/of/unittest.c Frank Rowand 2020-02-20 1467 "Duplicate name in testcase-data, renamed to \"duplicate-name#1\""); 0ac1743979408a drivers/of/unittest.c Frank Rowand 2020-02-20 1468 ae9304c9d31117 drivers/of/selftest.c Gaurav Minocha 2014-07-16 1469 /* attach the sub-tree to live tree */ 9697a5595ece52 drivers/of/unittest.c Wang Long 2015-03-11 1470 np = unittest_data_node->child; 5063e25a302e6a drivers/of/selftest.c Grant Likely 2014-10-03 1471 while (np) { 5063e25a302e6a drivers/of/selftest.c Grant Likely 2014-10-03 1472 struct device_node *next = np->sibling; 3db316d00bfa60 drivers/of/unittest.c Frank Rowand 2015-03-14 1473 5063e25a302e6a drivers/of/selftest.c Grant Likely 2014-10-03 1474 np->parent = of_root; 5063e25a302e6a drivers/of/selftest.c Grant Likely 2014-10-03 1475 attach_node_and_children(np); 5063e25a302e6a drivers/of/selftest.c Grant Likely 2014-10-03 1476 np = next; 5063e25a302e6a drivers/of/selftest.c Grant Likely 2014-10-03 1477 } f948d6d8b792bb drivers/of/unittest.c Frank Rowand 2017-10-17 1478 0ac1743979408a drivers/of/unittest.c Frank Rowand 2020-02-20 1479 EXPECT_END(KERN_INFO, 0ac1743979408a drivers/of/unittest.c Frank Rowand 2020-02-20 1480 "Duplicate name in testcase-data, renamed to \"duplicate-name#1\""); 0ac1743979408a drivers/of/unittest.c Frank Rowand 2020-02-20 1481 f948d6d8b792bb drivers/of/unittest.c Frank Rowand 2017-10-17 1482 of_overlay_mutex_unlock(); f948d6d8b792bb drivers/of/unittest.c Frank Rowand 2017-10-17 1483 5063e25a302e6a drivers/of/selftest.c Grant Likely 2014-10-03 1484 return 0; ae9304c9d31117 drivers/of/selftest.c Gaurav Minocha 2014-07-16 1485 } ae9304c9d31117 drivers/of/selftest.c Gaurav Minocha 2014-07-16 1486 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org
.config.gz
Description: application/gzip
_______________________________________________ kbuild mailing list -- kbuild@lists.01.org To unsubscribe send an email to kbuild-le...@lists.01.org