Fwd: [kbuild] [linux-next:master 1184/3379] drivers/of/fdt.c:196:4: warning: Value stored to 'pprev' is never read [clang-analyzer-deadcode.DeadStores]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   2265c5286967c58db9a99ed1b74105977507e690
commit: eb7173988caf6fc68ef00065b9defb5ac3467f21 [1184/3379] of: fdt: remove unnecessary codes
config: x86_64-randconfig-c001-20210726 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project c63dbd850182797bc4b76124d08e1c320ab2365d)
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
        # install x86_64 cross compiling tool for clang build
        # apt-get install binutils-x86-64-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=eb7173988caf6fc68ef00065b9defb5ac3467f21 git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
        git fetch --no-tags linux-next master
        git checkout eb7173988caf6fc68ef00065b9defb5ac3467f21
        # save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 clang-analyzer
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>


clang-analyzer warnings: (new ones prefixed by >>)
                   ^
drivers/mtd/chips/cfi_cmdset_0020.c:703:7: note: Assuming the condition is false if (ECCBUF_DIV(elem_len)) { /* write clean aligned data */
                       ^
drivers/mtd/chips/cfi_cmdset_0020.c:660:24: note: expanded from macro 'ECCBUF_DIV'
   #define ECCBUF_DIV(x) ((x) & ~(ECCBUF_SIZE - 1))
                          ^~~~~~~~~~~~~~~~~~~~~~~~
   drivers/mtd/chips/cfi_cmdset_0020.c:703:3: note: Taking false branch
if (ECCBUF_DIV(elem_len)) { /* write clean aligned data */
                   ^
drivers/mtd/chips/cfi_cmdset_0020.c:712:7: note: Assuming 'buflen' is not equal to 0
                   if (buflen) {
                       ^~~~~~
   drivers/mtd/chips/cfi_cmdset_0020.c:712:3: note: Taking true branch
                   if (buflen) {
                   ^
drivers/mtd/chips/cfi_cmdset_0020.c:714:29: note: The right operand of '+' is a garbage value
                           memcpy(buffer, elem_base + thislen, buflen);
                                                    ^ ~~~~~~~
drivers/mtd/chips/cfi_cmdset_0020.c:1035:16: warning: Value stored to 'timeo' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           unsigned long timeo = jiffies + HZ;
                         ^~~~~   ~~~~~~~~~~~~
drivers/mtd/chips/cfi_cmdset_0020.c:1035:16: note: Value stored to 'timeo' during its initialization is never read
           unsigned long timeo = jiffies + HZ;
                         ^~~~~   ~~~~~~~~~~~~
drivers/mtd/chips/cfi_cmdset_0020.c:1181:16: warning: Value stored to 'timeo' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           unsigned long timeo = jiffies + HZ;
                         ^~~~~   ~~~~~~~~~~~~
drivers/mtd/chips/cfi_cmdset_0020.c:1181:16: note: Value stored to 'timeo' during its initialization is never read
           unsigned long timeo = jiffies + HZ;
                         ^~~~~   ~~~~~~~~~~~~
   Suppressed 4 warnings (4 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   4 warnings generated.
   Suppressed 4 warnings (4 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   4 warnings generated.
   Suppressed 4 warnings (4 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   3 warnings generated.
   Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   2 warnings generated.
   Suppressed 2 warnings (2 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   2 warnings generated.
   Suppressed 2 warnings (2 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   3 warnings generated.
   Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   4 warnings generated.
drivers/nfc/st21nfca/i2c.c:321:4: warning: Value stored to 'i' is never read [clang-analyzer-deadcode.DeadStores]
                           i = 0;
                           ^   ~
drivers/nfc/st21nfca/i2c.c:321:4: note: Value stored to 'i' is never read
                           i = 0;
                           ^   ~
   Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   2 warnings generated.
   Suppressed 2 warnings (2 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   3 warnings generated.
   Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   3 warnings generated.
   Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   3 warnings generated.
   Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   3 warnings generated.
   Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   3 warnings generated.
   Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   3 warnings generated.
   Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   4 warnings generated.
   Suppressed 4 warnings (4 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   4 warnings generated.
   Suppressed 4 warnings (4 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   2 warnings generated.
   Suppressed 2 warnings (2 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   3 warnings generated.
   Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   3 warnings generated.
   Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   2 warnings generated.
   Suppressed 2 warnings (2 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   3 warnings generated.
drivers/of/fdt.c:196:4: warning: Value stored to 'pprev' is never read [clang-analyzer-deadcode.DeadStores]
                           pprev      = &pp->next;
                           ^            ~~~~~~~~~
   drivers/of/fdt.c:196:4: note: Value stored to 'pprev' is never read
                           pprev      = &pp->next;
                           ^            ~~~~~~~~~
   Suppressed 2 warnings (2 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   3 warnings generated.
   Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   4 warnings generated.
drivers/of/irq.c:567:2: warning: Dereference of null pointer [clang-analyzer-core.NullDereference] list_for_each_entry_safe(desc, temp_desc, &intc_parent_list, list) {
           ^
include/linux/list.h:716:7: note: expanded from macro 'list_for_each_entry_safe' n = list_next_entry(pos, member); \
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/list.h:555:2: note: expanded from macro 'list_next_entry'
           list_entry((pos)->member.next, typeof(*(pos)), member)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/list.h:511:2: note: expanded from macro 'list_entry'
           container_of(ptr, type, member)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/kernel.h:494:25: note: expanded from macro 'container_of'
void *__mptr = (void *)(ptr); \
                                  ^~~~~
drivers/of/irq.c:489:2: note: Loop condition is true. Entering loop body
           for_each_matching_node_and_match(np, matches, &match) {
           ^
include/linux/of.h:1292:2: note: expanded from macro 'for_each_matching_node_and_match' for (dn = of_find_matching_node_and_match(NULL, matches, match); \
           ^
   drivers/of/irq.c:490:8: note: Calling 'of_property_read_bool'
if (!of_property_read_bool(np, "interrupt-controller") ||
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/of.h:1230:9: note: Assuming 'prop' is non-null
           return prop ? true : false;
                  ^~~~
   include/linux/of.h:1230:9: note: '?' condition is true
include/linux/of.h:1230:2: note: Returning the value 1, which participates in a condition later
           return prop ? true : false;
           ^~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/of/irq.c:490:8: note: Returning from 'of_property_read_bool'
if (!of_property_read_bool(np, "interrupt-controller") ||
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/of/irq.c:490:7: note: Left side of '||' is false
if (!of_property_read_bool(np, "interrupt-controller") ||
                       ^
   drivers/of/irq.c:491:5: note: Assuming the condition is false
                                   !of_device_is_available(np))
                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/of/irq.c:490:3: note: Taking false branch
if (!of_property_read_bool(np, "interrupt-controller") ||
                   ^
   drivers/of/irq.c:494:12: note: Assuming field 'data' is non-null
if (WARN(!match->data, "of_irq_init: no init function for %s\n",
                            ^
   include/asm-generic/bug.h:130:25: note: expanded from macro 'WARN'
int __ret_warn_on = !!(condition); \
                                  ^~~~~~~~~
   drivers/of/irq.c:494:7: note: Taking false branch
if (WARN(!match->data, "of_irq_init: no init function for %s\n",
                       ^
   include/asm-generic/bug.h:131:2: note: expanded from macro 'WARN'
if (unlikely(__ret_warn_on)) \
           ^
   drivers/of/irq.c:494:3: note: Taking false branch
if (WARN(!match->data, "of_irq_init: no init function for %s\n",
                   ^
   drivers/of/irq.c:502:10: note: Calling 'kzalloc'
                   desc = kzalloc(sizeof(*desc), GFP_KERNEL);
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/slab.h:721:9: note: Calling 'kmalloc'
           return kmalloc(size, flags | __GFP_ZERO);
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/slab.h:579:2: note: Taking false branch
           if (__builtin_constant_p(size)) {
           ^
include/linux/slab.h:596:2: note: Returning pointer, which participates in a condition later
           return __kmalloc(size, flags);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/slab.h:721:9: note: Returning from 'kmalloc'
           return kmalloc(size, flags | __GFP_ZERO);
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/slab.h:721:2: note: Returning pointer, which participates in a condition later
           return kmalloc(size, flags | __GFP_ZERO);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/of/irq.c:502:10: note: Returning from 'kzalloc'
                   desc = kzalloc(sizeof(*desc), GFP_KERNEL);
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/of/irq.c:503:7: note: Assuming 'desc' is non-null
                   if (!desc) {
                       ^~~~~
   drivers/of/irq.c:503:3: note: Taking false branch
                   if (!desc) {
                   ^
drivers/of/irq.c:511:33: note: 'np' is not equal to field 'interrupt_parent'
                   if (desc->interrupt_parent == np)
                                                 ^~
   drivers/of/irq.c:511:3: note: Taking false branch

vim +/pprev +196 drivers/of/fdt.c

bbd33931a08362 Grant Likely 2009-11-23 106 dfbd4c6eff35f1 Gavin Shan 2016-05-03 107 static void populate_properties(const void *blob,
dfbd4c6eff35f1 Gavin Shan   2016-05-03  108  				int offset,
dfbd4c6eff35f1 Gavin Shan   2016-05-03  109  				void **mem,
dfbd4c6eff35f1 Gavin Shan   2016-05-03  110  				struct device_node *np,
dfbd4c6eff35f1 Gavin Shan   2016-05-03  111  				const char *nodename,
dfbd4c6eff35f1 Gavin Shan   2016-05-03  112  				bool dryrun)
dfbd4c6eff35f1 Gavin Shan   2016-05-03  113  {
dfbd4c6eff35f1 Gavin Shan 2016-05-03 114 struct property *pp, **pprev = NULL;
dfbd4c6eff35f1 Gavin Shan   2016-05-03  115  	int cur;
dfbd4c6eff35f1 Gavin Shan   2016-05-03  116  	bool has_name = false;
dfbd4c6eff35f1 Gavin Shan 2016-05-03 117 dfbd4c6eff35f1 Gavin Shan 2016-05-03 118 pprev = &np->properties; dfbd4c6eff35f1 Gavin Shan 2016-05-03 119 for (cur = fdt_first_property_offset(blob, offset);
dfbd4c6eff35f1 Gavin Shan   2016-05-03  120  	     cur >= 0;
dfbd4c6eff35f1 Gavin Shan 2016-05-03 121 cur = fdt_next_property_offset(blob, cur)) {
dfbd4c6eff35f1 Gavin Shan   2016-05-03  122  		const __be32 *val;
dfbd4c6eff35f1 Gavin Shan   2016-05-03  123  		const char *pname;
dfbd4c6eff35f1 Gavin Shan   2016-05-03  124  		u32 sz;
dfbd4c6eff35f1 Gavin Shan 2016-05-03 125 dfbd4c6eff35f1 Gavin Shan 2016-05-03 126 val = fdt_getprop_by_offset(blob, cur, &pname, &sz);
dfbd4c6eff35f1 Gavin Shan   2016-05-03  127  		if (!val) {
606ad42aa3b1fe Rob Herring 2016-06-15 128 pr_warn("Cannot locate property at 0x%x\n", cur);
dfbd4c6eff35f1 Gavin Shan   2016-05-03  129  			continue;
dfbd4c6eff35f1 Gavin Shan   2016-05-03  130  		}
dfbd4c6eff35f1 Gavin Shan 2016-05-03 131 dfbd4c6eff35f1 Gavin Shan 2016-05-03 132 if (!pname) { 606ad42aa3b1fe Rob Herring 2016-06-15 133 pr_warn("Cannot find property name at 0x%x\n", cur);
dfbd4c6eff35f1 Gavin Shan   2016-05-03  134  			continue;
dfbd4c6eff35f1 Gavin Shan   2016-05-03  135  		}
dfbd4c6eff35f1 Gavin Shan 2016-05-03 136 dfbd4c6eff35f1 Gavin Shan 2016-05-03 137 if (!strcmp(pname, "name"))
dfbd4c6eff35f1 Gavin Shan   2016-05-03  138  			has_name = true;
dfbd4c6eff35f1 Gavin Shan 2016-05-03 139 dfbd4c6eff35f1 Gavin Shan 2016-05-03 140 pp = unflatten_dt_alloc(mem, sizeof(struct property), dfbd4c6eff35f1 Gavin Shan 2016-05-03 141 __alignof__(struct property));
dfbd4c6eff35f1 Gavin Shan   2016-05-03  142  		if (dryrun)
dfbd4c6eff35f1 Gavin Shan   2016-05-03  143  			continue;
dfbd4c6eff35f1 Gavin Shan 2016-05-03 144 dfbd4c6eff35f1 Gavin Shan 2016-05-03 145 /* We accept flattened tree phandles either in dfbd4c6eff35f1 Gavin Shan 2016-05-03 146 * ePAPR-style "phandle" properties, or the dfbd4c6eff35f1 Gavin Shan 2016-05-03 147 * legacy "linux,phandle" properties. If both dfbd4c6eff35f1 Gavin Shan 2016-05-03 148 * appear and have different values, things dfbd4c6eff35f1 Gavin Shan 2016-05-03 149 * will get weird. Don't do that.
bbd33931a08362 Grant Likely 2009-11-23  150  		 */
dfbd4c6eff35f1 Gavin Shan 2016-05-03 151 if (!strcmp(pname, "phandle") || dfbd4c6eff35f1 Gavin Shan 2016-05-03 152 !strcmp(pname, "linux,phandle")) {
dfbd4c6eff35f1 Gavin Shan   2016-05-03  153  			if (!np->phandle)
dfbd4c6eff35f1 Gavin Shan 2016-05-03 154 np->phandle = be32_to_cpup(val);
dfbd4c6eff35f1 Gavin Shan   2016-05-03  155  		}
dfbd4c6eff35f1 Gavin Shan 2016-05-03 156 dfbd4c6eff35f1 Gavin Shan 2016-05-03 157 /* And we process the "ibm,phandle" property dfbd4c6eff35f1 Gavin Shan 2016-05-03 158 * used in pSeries dynamic device tree
dfbd4c6eff35f1 Gavin Shan   2016-05-03  159  		 * stuff
dfbd4c6eff35f1 Gavin Shan   2016-05-03  160  		 */
dfbd4c6eff35f1 Gavin Shan 2016-05-03 161 if (!strcmp(pname, "ibm,phandle")) dfbd4c6eff35f1 Gavin Shan 2016-05-03 162 np->phandle = be32_to_cpup(val); dfbd4c6eff35f1 Gavin Shan 2016-05-03 163 dfbd4c6eff35f1 Gavin Shan 2016-05-03 164 pp->name = (char *)pname;
dfbd4c6eff35f1 Gavin Shan   2016-05-03  165  		pp->length = sz;
dfbd4c6eff35f1 Gavin Shan   2016-05-03  166  		pp->value  = (__be32 *)val;
dfbd4c6eff35f1 Gavin Shan   2016-05-03  167  		*pprev     = pp;
dfbd4c6eff35f1 Gavin Shan   2016-05-03  168  		pprev      = &pp->next;
dfbd4c6eff35f1 Gavin Shan   2016-05-03  169  	}
dfbd4c6eff35f1 Gavin Shan 2016-05-03 170 dfbd4c6eff35f1 Gavin Shan 2016-05-03 171 /* With version 0x10 we may not have the name property, dfbd4c6eff35f1 Gavin Shan 2016-05-03 172 * recreate it here from the unit name if absent
dfbd4c6eff35f1 Gavin Shan   2016-05-03  173  	 */
dfbd4c6eff35f1 Gavin Shan   2016-05-03  174  	if (!has_name) {
dfbd4c6eff35f1 Gavin Shan 2016-05-03 175 const char *p = nodename, *ps = p, *pa = NULL;
dfbd4c6eff35f1 Gavin Shan   2016-05-03  176  		int len;
dfbd4c6eff35f1 Gavin Shan 2016-05-03 177 dfbd4c6eff35f1 Gavin Shan 2016-05-03 178 while (*p) {
dfbd4c6eff35f1 Gavin Shan   2016-05-03  179  			if ((*p) == '@')
dfbd4c6eff35f1 Gavin Shan   2016-05-03  180  				pa = p;
dfbd4c6eff35f1 Gavin Shan   2016-05-03  181  			else if ((*p) == '/')
dfbd4c6eff35f1 Gavin Shan   2016-05-03  182  				ps = p + 1;
dfbd4c6eff35f1 Gavin Shan   2016-05-03  183  			p++;
dfbd4c6eff35f1 Gavin Shan   2016-05-03  184  		}
dfbd4c6eff35f1 Gavin Shan 2016-05-03 185 dfbd4c6eff35f1 Gavin Shan 2016-05-03 186 if (pa < ps)
dfbd4c6eff35f1 Gavin Shan   2016-05-03  187  			pa = p;
dfbd4c6eff35f1 Gavin Shan   2016-05-03  188  		len = (pa - ps) + 1;
dfbd4c6eff35f1 Gavin Shan 2016-05-03 189 pp = unflatten_dt_alloc(mem, sizeof(struct property) + len, dfbd4c6eff35f1 Gavin Shan 2016-05-03 190 __alignof__(struct property));
dfbd4c6eff35f1 Gavin Shan   2016-05-03  191  		if (!dryrun) {
dfbd4c6eff35f1 Gavin Shan   2016-05-03  192  			pp->name   = "name";
dfbd4c6eff35f1 Gavin Shan   2016-05-03  193  			pp->length = len;
dfbd4c6eff35f1 Gavin Shan   2016-05-03  194  			pp->value  = pp + 1;
dfbd4c6eff35f1 Gavin Shan   2016-05-03  195  			*pprev     = pp;
dfbd4c6eff35f1 Gavin Shan   2016-05-03 @196  			pprev      = &pp->next;
dfbd4c6eff35f1 Gavin Shan 2016-05-03 197 memcpy(pp->value, ps, len - 1); dfbd4c6eff35f1 Gavin Shan 2016-05-03 198 ((char *)pp->value)[len - 1] = 0; dfbd4c6eff35f1 Gavin Shan 2016-05-03 199 pr_debug("fixed up name for %s -> %s\n", dfbd4c6eff35f1 Gavin Shan 2016-05-03 200 nodename, (char *)pp->value);
dfbd4c6eff35f1 Gavin Shan   2016-05-03  201  		}
dfbd4c6eff35f1 Gavin Shan   2016-05-03  202  	}
dfbd4c6eff35f1 Gavin Shan   2016-05-03  203  }
dfbd4c6eff35f1 Gavin Shan   2016-05-03  204
:::::: The code at line 196 was first introduced by commit
:::::: dfbd4c6eff35f1b1065cca046003cc9d7ff27222 drivers/of: Split unflatten_dt_node()

:::::: TO: Gavin Shan <gwshan@xxxxxxxxxxxxxxxxxx>
:::::: CC: Rob Herring <robh@xxxxxxxxxx>

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

Attachment: .config.gz
Description: application/gzip

_______________________________________________
kbuild mailing list -- kbuild@xxxxxxxxxxxx
To unsubscribe send an email to kbuild-leave@xxxxxxxxxxxx


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux