* [Intel-wired-lan] [PATCH] e1000e:Fix incorrect assumption that the function e1000e_up always runs successfully in e1000_change_mtu
@ 2015-10-24 4:09 Nicholas Krause
2015-10-24 6:01 ` Alexander Duyck
0 siblings, 1 reply; 3+ messages in thread
From: Nicholas Krause @ 2015-10-24 4:09 UTC (permalink / raw)
To: intel-wired-lan
This fixes the function e1000_change_mtu to properly check and run
the error code by e1000e_up as this function can fail and the error
code should be returned to the caller of the function e1000_change_mtu
to signal a error has occurred when calling this particular function
Signed-off-by: Nicholas Krause <xerofoify@gmail.com>
---
drivers/net/ethernet/intel/e1000e/netdev.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
index faf4b3f..aebccb1 100644
--- a/drivers/net/ethernet/intel/e1000e/netdev.c
+++ b/drivers/net/ethernet/intel/e1000e/netdev.c
@@ -5931,6 +5931,7 @@ static int e1000_change_mtu(struct net_device *netdev, int new_mtu)
{
struct e1000_adapter *adapter = netdev_priv(netdev);
int max_frame = new_mtu + VLAN_ETH_HLEN + ETH_FCS_LEN;
+ int err = 0;
/* Jumbo frame support */
if ((max_frame > (VLAN_ETH_FRAME_LEN + ETH_FCS_LEN)) &&
@@ -5984,7 +5985,9 @@ static int e1000_change_mtu(struct net_device *netdev, int new_mtu)
adapter->rx_buffer_len = VLAN_ETH_FRAME_LEN + ETH_FCS_LEN;
if (netif_running(netdev))
- e1000e_up(adapter);
+ err = e1000e_up(adapter);
+ if (err)
+ e_err("Failed to successfully bring up this adapter\n");
else
e1000e_reset(adapter);
@@ -5992,7 +5995,7 @@ static int e1000_change_mtu(struct net_device *netdev, int new_mtu)
clear_bit(__E1000_RESETTING, &adapter->state);
- return 0;
+ return err;
}
static int e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr,
--
2.1.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [Intel-wired-lan] [PATCH] e1000e:Fix incorrect assumption that the function e1000e_up always runs successfully in e1000_change_mtu
2015-10-24 4:09 [Intel-wired-lan] [PATCH] e1000e:Fix incorrect assumption that the function e1000e_up always runs successfully in e1000_change_mtu Nicholas Krause
@ 2015-10-24 6:01 ` Alexander Duyck
2015-10-24 18:18 ` nick
0 siblings, 1 reply; 3+ messages in thread
From: Alexander Duyck @ 2015-10-24 6:01 UTC (permalink / raw)
To: intel-wired-lan
On 10/23/2015 09:09 PM, Nicholas Krause wrote:
> This fixes the function e1000_change_mtu to properly check and run
> the error code by e1000e_up as this function can fail and the error
> code should be returned to the caller of the function e1000_change_mtu
> to signal a error has occurred when calling this particular function
The function e1000e_up always returns 0. It should probably be switched
to a void instead of an int. You could probably go through and drop a
bunch of dead code that is checking for the result of that function as well.
> Signed-off-by: Nicholas Krause <xerofoify@gmail.com>
> ---
> drivers/net/ethernet/intel/e1000e/netdev.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
> index faf4b3f..aebccb1 100644
> --- a/drivers/net/ethernet/intel/e1000e/netdev.c
> +++ b/drivers/net/ethernet/intel/e1000e/netdev.c
> @@ -5931,6 +5931,7 @@ static int e1000_change_mtu(struct net_device *netdev, int new_mtu)
> {
> struct e1000_adapter *adapter = netdev_priv(netdev);
> int max_frame = new_mtu + VLAN_ETH_HLEN + ETH_FCS_LEN;
> + int err = 0;
>
> /* Jumbo frame support */
> if ((max_frame > (VLAN_ETH_FRAME_LEN + ETH_FCS_LEN)) &&
> @@ -5984,7 +5985,9 @@ static int e1000_change_mtu(struct net_device *netdev, int new_mtu)
> adapter->rx_buffer_len = VLAN_ETH_FRAME_LEN + ETH_FCS_LEN;
>
> if (netif_running(netdev))
> - e1000e_up(adapter);
> + err = e1000e_up(adapter);
> + if (err)
> + e_err("Failed to successfully bring up this adapter\n");
> else
> e1000e_reset(adapter);
>
> @@ -5992,7 +5995,7 @@ static int e1000_change_mtu(struct net_device *netdev, int new_mtu)
>
> clear_bit(__E1000_RESETTING, &adapter->state);
>
> - return 0;
> + return err;
> }
>
> static int e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr,
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Intel-wired-lan] [PATCH] e1000e:Fix incorrect assumption that the function e1000e_up always runs successfully in e1000_change_mtu
2015-10-24 6:01 ` Alexander Duyck
@ 2015-10-24 18:18 ` nick
0 siblings, 0 replies; 3+ messages in thread
From: nick @ 2015-10-24 18:18 UTC (permalink / raw)
To: intel-wired-lan
On 2015-10-24 02:01 AM, Alexander Duyck wrote:
> On 10/23/2015 09:09 PM, Nicholas Krause wrote:
>> This fixes the function e1000_change_mtu to properly check and run
>> the error code by e1000e_up as this function can fail and the error
>> code should be returned to the caller of the function e1000_change_mtu
>> to signal a error has occurred when calling this particular function
>
> The function e1000e_up always returns 0. It should probably be switched to a void instead of an int. You could probably go through and drop a bunch of dead code that is checking for the result of that function as well.
>
There is none that I known of but if you want I will check again to make sure and make the
function e1000_up_always void.
Nick
>> Signed-off-by: Nicholas Krause <xerofoify@gmail.com>
>> ---
>> drivers/net/ethernet/intel/e1000e/netdev.c | 7 +++++--
>> 1 file changed, 5 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
>> index faf4b3f..aebccb1 100644
>> --- a/drivers/net/ethernet/intel/e1000e/netdev.c
>> +++ b/drivers/net/ethernet/intel/e1000e/netdev.c
>> @@ -5931,6 +5931,7 @@ static int e1000_change_mtu(struct net_device *netdev, int new_mtu)
>> {
>> struct e1000_adapter *adapter = netdev_priv(netdev);
>> int max_frame = new_mtu + VLAN_ETH_HLEN + ETH_FCS_LEN;
>> + int err = 0;
>> /* Jumbo frame support */
>> if ((max_frame > (VLAN_ETH_FRAME_LEN + ETH_FCS_LEN)) &&
>> @@ -5984,7 +5985,9 @@ static int e1000_change_mtu(struct net_device *netdev, int new_mtu)
>> adapter->rx_buffer_len = VLAN_ETH_FRAME_LEN + ETH_FCS_LEN;
>> if (netif_running(netdev))
>> - e1000e_up(adapter);
>> + err = e1000e_up(adapter);
>> + if (err)
>> + e_err("Failed to successfully bring up this adapter\n");
>> else
>> e1000e_reset(adapter);
>> @@ -5992,7 +5995,7 @@ static int e1000_change_mtu(struct net_device *netdev, int new_mtu)
>> clear_bit(__E1000_RESETTING, &adapter->state);
>> - return 0;
>> + return err;
>> }
>> static int e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr,
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-10-24 18:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-24 4:09 [Intel-wired-lan] [PATCH] e1000e:Fix incorrect assumption that the function e1000e_up always runs successfully in e1000_change_mtu Nicholas Krause
2015-10-24 6:01 ` Alexander Duyck
2015-10-24 18:18 ` nick
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).