netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* re: bnx2x: Added EEE support
@ 2012-06-08 13:09 Dan Carpenter
  2012-06-10  7:47 ` Yuval Mintz
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2012-06-08 13:09 UTC (permalink / raw)
  To: yuvalmin; +Cc: netdev

Hello Yuval Mintz,

The patch c8c60d88c59c: "bnx2x: Added EEE support" from Jun 6, 2012, 
leads to the following warning:
drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c:10121 
bnx2x_848x3_config_init()
	 error: buffer overflow 'params->req_duplex' 2 <= 4

drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
 10032          actual_phy_selection = bnx2x_phy_selection(params);
 10033  
 10034          switch (actual_phy_selection) {
 10035          case PORT_HW_CFG_PHY_SELECTION_HARDWARE_DEFAULT:
 10036                  /* Do nothing. Essentially this is like the priority copper */
 10037                  break;
 10038          case PORT_HW_CFG_PHY_SELECTION_FIRST_PHY_PRIORITY:
 10039                  val |= MDIO_CTL_REG_84823_MEDIA_PRIORITY_COPPER;
 10040                  break;
 10041          case PORT_HW_CFG_PHY_SELECTION_SECOND_PHY_PRIORITY:
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
We assume "actual_phy_selection" can be 4 here.

 10042                  val |= MDIO_CTL_REG_84823_MEDIA_PRIORITY_FIBER;
 10043                  break;

[snip]

 10121                  if ((params->req_duplex[actual_phy_selection] == DUPLEX_FULL) &&
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This array only has 2 elements so 4 is beyond the end.

 10122                      (params->eee_mode & EEE_MODE_ADV_LPI) &&
 10123                      (bnx2x_eee_calc_timer(params) ||
 10124                       !(params->eee_mode & EEE_MODE_ENABLE_LPI)))
 10125                          rc = bnx2x_8483x_enable_eee(phy, params, vars);
 10126                  else

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-10-22 12:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-08 13:09 bnx2x: Added EEE support Dan Carpenter
2012-06-10  7:47 ` Yuval Mintz
2012-10-22 12:06   ` Dan Carpenter
2012-10-22 12:15     ` Yuval Mintz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).