Skip to contentSkip to conversation

bnx2x: Added EEE support

DISCUSSION Dan Carpenter 2 participants 4 messages Jun 8, 2012 – Oct 22, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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

#1 lore raw
Quoted 6 lines

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

Hi Dan,

You are right - this is indeed an error, although one that shouldn't affect any existing bnx2x chip supporting EEE.

I'll send a patch correcting it soon.

Thanks,
Yuval

#2 lore raw
Quoted 7 lines · Yuval Mintz
Quoted 6 lines

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
Quoted 7 lines

Hi Dan,

You are right - this is indeed an error, although one that shouldn't affect any existing bnx2x chip supporting EEE.

I'll send a patch correcting it soon.

What happened with this?

regards,
dan carpenter

#3 lore raw
Quoted 13 lines · Yuval Mintz
Quoted 12 lines
Quoted 6 lines

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

Hi Dan,

You are right - this is indeed an error, although one that shouldn't affect any existing bnx2x chip supporting EEE.

Quoted 9 lines
Quoted 2 lines

I'll send a patch correcting it soon.

What happened with this?

regards,
dan carpenter

The patch will be sent upstream in the next couple of days.

Thanks,
Yuval