[dpdk-dev,1/3] net/cxgbe: init data value before reading seeprom

Message ID 20170124204859.8998-1-emmanuel.roullit@gmail.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel compilation success Compilation OK

Commit Message

Emmanuel Roullit Jan. 24, 2017, 8:48 p.m. UTC
  data value could have been garbage if VPD access timed out for VPD read
request could not been issued.

Found with clang static analysis:
drivers/net/cxgbe/base/t4_hw.c:1577:22:
warning: The left operand of '&' is a garbage value
        } while ((stats_reg & 0x1) && --max_poll);
                  ~~~~~~~~~ ^

Fixes: 17ba077c5c54 ("net/cxgbe: support register dump")

Signed-off-by: Emmanuel Roullit <emmanuel.roullit@gmail.com>
---
 drivers/net/cxgbe/base/t4_hw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Ferruh Yigit Jan. 25, 2017, 12:12 p.m. UTC | #1
On 1/24/2017 8:48 PM, Emmanuel Roullit wrote:
> data value could have been garbage if VPD access timed out for VPD read
> request could not been issued.
> 
> Found with clang static analysis:
> drivers/net/cxgbe/base/t4_hw.c:1577:22:
> warning: The left operand of '&' is a garbage value
>         } while ((stats_reg & 0x1) && --max_poll);
>                   ~~~~~~~~~ ^
> 
> Fixes: 17ba077c5c54 ("net/cxgbe: support register dump")
> 
> Signed-off-by: Emmanuel Roullit <emmanuel.roullit@gmail.com>

Applied to dpdk-next-net/master, thanks.
  
Ferruh Yigit Jan. 26, 2017, 11:06 a.m. UTC | #2
On 1/25/2017 12:12 PM, Ferruh Yigit wrote:
> On 1/24/2017 8:48 PM, Emmanuel Roullit wrote:
>> data value could have been garbage if VPD access timed out for VPD read
>> request could not been issued.
>>
>> Found with clang static analysis:
>> drivers/net/cxgbe/base/t4_hw.c:1577:22:
>> warning: The left operand of '&' is a garbage value
>>         } while ((stats_reg & 0x1) && --max_poll);
>>                   ~~~~~~~~~ ^
>>
>> Fixes: 17ba077c5c54 ("net/cxgbe: support register dump")
>>
>> Signed-off-by: Emmanuel Roullit <emmanuel.roullit@gmail.com>
> 
> Applied to dpdk-next-net/master, thanks.
> 

Fixes: fe0bd9ee5da3 ("net/cxgbe: support EEPROM access")
Cc: stable@dpdk.org
  

Patch

diff --git a/drivers/net/cxgbe/base/t4_hw.c b/drivers/net/cxgbe/base/t4_hw.c
index 7e79adf6d..c089b068d 100644
--- a/drivers/net/cxgbe/base/t4_hw.c
+++ b/drivers/net/cxgbe/base/t4_hw.c
@@ -1532,7 +1532,7 @@  int t4_seeprom_write(struct adapter *adapter, u32 addr, u32 data)
 {
 	unsigned int base = adapter->params.pci.vpd_cap_addr;
 	int ret;
-	u32 stats_reg;
+	u32 stats_reg = 0;
 	int max_poll;
 
 	/* VPD Accesses must alway be 4-byte aligned!