All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kernel-janitors@vger.kernel.org
Subject: [bug report] phy: add driver for Microsemi Ocelot SerDes muxing
Date: Wed, 10 Oct 2018 10:48:23 +0000	[thread overview]
Message-ID: <20181010104823.GA15888@mwanda> (raw)

Hello Quentin Schulz,

The patch 51f6b410fc22: "phy: add driver for Microsemi Ocelot SerDes
muxing" from Oct 4, 2018, leads to the following static checker
warning:

	drivers/phy/mscc/phy-ocelot-serdes.c:210 serdes_simple_xlate()
	error: buffer overflow 'ctrl->phys' 8 <= 8

drivers/phy/mscc/phy-ocelot-serdes.c
   197  static struct phy *serdes_simple_xlate(struct device *dev,
   198                                         struct of_phandle_args *args)
   199  {
   200          struct serdes_ctrl *ctrl = dev_get_drvdata(dev);
   201          unsigned int port, idx, i;
   202  
   203          if (args->args_count != 2)
   204                  return ERR_PTR(-EINVAL);
   205  
   206          port = args->args[0];
   207          idx = args->args[1];
   208  
   209          for (i = 0; i <= SERDES_MAX; i++) {
                              ^^
Should this be < ?

   210                  struct serdes_macro *macro = phy_get_drvdata(ctrl->phys[i]);
                                                                     ^^^^^^^^^^^^^
Or is this array too small?

   211  
   212                  if (idx != macro->idx)
   213                          continue;
   214  
   215                  /* SERDES6G(0) is the only SerDes capable of QSGMII */
   216                  if (idx != SERDES6G(0) && macro->port >= 0)
   217                          return ERR_PTR(-EBUSY);
   218  
   219                  macro->port = port;
   220                  return ctrl->phys[i];
   221          }
   222  
   223          return ERR_PTR(-ENODEV);
   224  }

regards,
dan carpenter

             reply	other threads:[~2018-10-10 10:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-10 10:48 Dan Carpenter [this message]
2018-10-10 12:10 ` [bug report] phy: add driver for Microsemi Ocelot SerDes muxing Quentin Schulz

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=20181010104823.GA15888@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.