re: dsa: add device tree bindings to register DSA switches

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

 



Hello Florian Fainelli,

The patch 5e95329b701c: "dsa: add device tree bindings to register
DSA switches" from Mar 22, 2013, leads to the following static
checker warning:

	net/dsa/dsa.c:669 dsa_of_probe()
	error: testing array offset 'port_index' after use.

net/dsa/dsa.c
   644                          port_index = be32_to_cpup(port_reg);
   645  
   646                          port_name = of_get_property(port, "label", NULL);
   647                          if (!port_name)
   648                                  continue;
   649  
   650                          cd->port_dn[port_index] = port;
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Write.

   651  
   652                          cd->port_names[port_index] = kstrdup(port_name,
   653                                          GFP_KERNEL);
   654                          if (!cd->port_names[port_index]) {
   655                                  ret = -ENOMEM;
   656                                  goto out_free_chip;
   657                          }
   658  
   659                          link = of_parse_phandle(port, "link", 0);
   660  
   661                          if (!strcmp(port_name, "dsa") && link &&
   662                                          pd->nr_chips > 1) {
   663                                  ret = dsa_of_setup_routing_table(pd, cd,
   664                                                  chip_index, port_index, link);
   665                                  if (ret)
   666                                          goto out_free_chip;
   667                          }
   668  
   669                          if (port_index == DSA_MAX_PORTS)
                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
The write was out of bounds memory corruption.  Oops.  Too late.

   670                                  break;
   671                  }

regards,
dan carpenter
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux