Skip to contentSkip to conversation

ibmvnic: Fix returning uninitialized return code

PATCH In review Thomas Falcon 2 participants 3 messages Sep 16, 2020 – Sep 17, 2020

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

PATCH 1/1 ibmvnic: Fix returning uninitialized return code

If successful, __ibmvnic_open and reset_sub_crq_queues, if no device queues exist, will return an uninitialized variable rc. Return zero on success instead.

Fixes 57a49436f4e8 ("ibmvnic: Reset sub-crqs during driver reset")
Fixes ed651a10875f ("ibmvnic: Updated reset handling")
---
 drivers/net/ethernet/ibm/ibmvnic.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/ibm/ibmvnic.c +2 -2
index 1b702a4..1619311 100644
@@ -1178,7 +1178,7 @@ static int __ibmvnic_open(struct net_device *netdev)
 	}
 
 	adapter->state = VNIC_OPEN;
-	return rc;
+	return 0;
 }
 
 static int ibmvnic_open(struct net_device *netdev)
@@ -2862,7 +2862,7 @@ static int reset_sub_crq_queues(struct ibmvnic_adapter *adapter)
 			return rc;
 	}
 
-	return rc;
+	return 0;
 }
 
 static void release_sub_crq_queue(struct ibmvnic_adapter *adapter,
Signature · 1 line
1.8.3.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 17 lines · Thomas Falcon

If successful, __ibmvnic_open and reset_sub_crq_queues, if no device queues exist, will return an uninitialized variable rc. Return zero on success instead.

Fixes 57a49436f4e8 ("ibmvnic: Reset sub-crqs during driver reset")
Fixes ed651a10875f ("ibmvnic: Updated reset handling")
---
 drivers/net/ethernet/ibm/ibmvnic.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/ibm/ibmvnic.c +0 -0
index 1b702a4..1619311 100644

drivers/net/ethernet/ibm/ibmvnic.c static int __ibmvnic_open(struct net_device · line 1182

Quoted 6 lines
drivers/net/ethernet/ibm/ibmvnic.c +1 -1
@@ -1178,7 +1178,7 @@ static int __ibmvnic_open(struct net_device
 *netdev)
 	}
 
 	adapter->state = VNIC_OPEN;
-	return rc;
+	return 0;

rc here is unconditionally assigned a couple of lines earlier, but anyway i don't mind this change as it explicitly states that this is a success path.

But maybe you want to split the patch and send this hunk to net-next. I don't mind, up to you.

drivers/net/ethernet/ibm/ibmvnic.c static int reset_sub_crq_queues(struct · line 2866

Quoted 10 lines
drivers/net/ethernet/ibm/ibmvnic.c +0 -0
 }
 

static int ibmvnic_open(struct net_device *netdev)

drivers/net/ethernet/ibm/ibmvnic.c +1 -1
@@ -2862,7 +2862,7 @@ static int reset_sub_crq_queues(struct
 ibmvnic_adapter *adapter)
 			return rc;
 	}
 
-	return rc;
+	return 0;

This one though is fine,

#2 lore raw
Quoted 28 lines · Saeed Mahameed
Quoted 17 lines · Thomas Falcon

If successful, __ibmvnic_open and reset_sub_crq_queues, if no device queues exist, will return an uninitialized variable rc. Return zero on success instead.

Fixes 57a49436f4e8 ("ibmvnic: Reset sub-crqs during driver reset")
Fixes ed651a10875f ("ibmvnic: Updated reset handling")
---
  drivers/net/ethernet/ibm/ibmvnic.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/ibm/ibmvnic.c +0 -0
index 1b702a4..1619311 100644

drivers/net/ethernet/ibm/ibmvnic.c static int __ibmvnic_open(struct net_device · line 1182

Quoted 6 lines
drivers/net/ethernet/ibm/ibmvnic.c +1 -1
@@ -1178,7 +1178,7 @@ static int __ibmvnic_open(struct net_device
 *netdev)
  	}
 
  	adapter->state = VNIC_OPEN;
-	return rc;
+	return 0;

rc here is unconditionally assigned a couple of lines earlier, but anyway i don't mind this change as it explicitly states that this is a success path.

Quoted 2 lines

But maybe you want to split the patch and send this hunk to net-next. I don't mind, up to you.

Thanks for catching that, I'll send a v2 with just the second hunk.

Tom

Quoted 16 lines

drivers/net/ethernet/ibm/ibmvnic.c static int reset_sub_crq_queues(struct · line 2866

Quoted 11 lines
drivers/net/ethernet/ibm/ibmvnic.c +0 -0
  }
 

static int ibmvnic_open(struct net_device *netdev)

drivers/net/ethernet/ibm/ibmvnic.c +1 -1
@@ -2862,7 +2862,7 @@ static int reset_sub_crq_queues(struct
 ibmvnic_adapter *adapter)
  			return rc;
  	}
 
-	return rc;
+	return 0;

This one though is fine,