public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kernel-janitors@vger.kernel.org
Subject: re: dsa: add device tree bindings to register DSA switches
Date: Wed, 10 Jun 2015 15:51:54 +0000	[thread overview]
Message-ID: <20150610155154.GL10549@mwanda> (raw)

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

                 reply	other threads:[~2015-06-10 15:51 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150610155154.GL10549@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=kernel-janitors@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox