[dpdk-dev] net/nfp: initialize stats struct

Message ID 1510142385-23710-1-git-send-email-alejandro.lucero@netronome.com
State Accepted, archived
Delegated to: Ferruh Yigit
Headers show

Checks

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

Commit Message

Alejandro Lucero Nov. 8, 2017, 11:59 a.m.
Not all struct fields will be written and random data could
confuse readers.

Fixes: 92aa491b881e ("nfp: add statistics")
Coverity: 140755

Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
---
 drivers/net/nfp/nfp_net.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Ferruh Yigit Nov. 10, 2017, 1:10 a.m. | #1
On 11/8/2017 3:59 AM, Alejandro Lucero wrote:
> Not all struct fields will be written and random data could
> confuse readers.
> 
> Fixes: 92aa491b881e ("nfp: add statistics")
> Coverity: 140755

Hi Alejandro,

Thank you for coverity fixes, but they will be considered for next release,
since trying to limit rc4 only for critical fixes.

Thanks,
ferruh

> 
> Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
Stephen Hemminger Nov. 10, 2017, 4:05 a.m. | #2
On Thu, 9 Nov 2017 17:10:16 -0800
Ferruh Yigit <ferruh.yigit@intel.com> wrote:

> On 11/8/2017 3:59 AM, Alejandro Lucero wrote:
> > Not all struct fields will be written and random data could
> > confuse readers.
> > 
> > Fixes: 92aa491b881e ("nfp: add statistics")
> > Coverity: 140755  
> 
> Hi Alejandro,
> 
> Thank you for coverity fixes, but they will be considered for next release,
> since trying to limit rc4 only for critical fixes.
> 
> Thanks,
> ferruh
> 
> > 
> > Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>  
> 

This looks like a bug fix. because the stats are on the stack and will
be garbage.
Ferruh Yigit Nov. 10, 2017, 8:55 a.m. | #3
On 11/9/2017 8:05 PM, Stephen Hemminger wrote:
> On Thu, 9 Nov 2017 17:10:16 -0800
> Ferruh Yigit <ferruh.yigit@intel.com> wrote:
> 
>> On 11/8/2017 3:59 AM, Alejandro Lucero wrote:
>>> Not all struct fields will be written and random data could
>>> confuse readers.
>>>
>>> Fixes: 92aa491b881e ("nfp: add statistics")
>>> Coverity: 140755  
>>
>> Hi Alejandro,
>>
>> Thank you for coverity fixes, but they will be considered for next release,
>> since trying to limit rc4 only for critical fixes.
>>
>> Thanks,
>> ferruh
>>
>>>
>>> Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>  
>>
> 
> This looks like a bug fix. because the stats are on the stack and will
> be garbage.

Yes it is, also other nfp patches are fixes.

This is for an effort to close the release, eventually it needs to stop
somewhere, and technically after rc3 is only for critical bug fixes, so this is
the time for stop getting these kind of patches.

After above said, relying on scope of the patches are PMD only and patches are
sent by driver maintainers, I will get them, reminding Thomas' right to drop
them back if he disagrees.
Ferruh Yigit Nov. 10, 2017, 9:37 a.m. | #4
On 11/8/2017 3:59 AM, Alejandro Lucero wrote:
> Not all struct fields will be written and random data could
> confuse readers.
> 
> Fixes: 92aa491b881e ("nfp: add statistics")
> Coverity: 140755
> 
> Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>

Applied to dpdk/master, thanks.

Patch

diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
index 83dec06..0501156 100644
--- a/drivers/net/nfp/nfp_net.c
+++ b/drivers/net/nfp/nfp_net.c
@@ -1038,6 +1038,8 @@  enum nfp_qcp_ptr {
 
 	/* RTE_ETHDEV_QUEUE_STAT_CNTRS default value is 16 */
 
+	memset(&nfp_dev_stats, 0, sizeof(nfp_dev_stats));
+
 	/* reading per RX ring stats */
 	for (i = 0; i < dev->data->nb_rx_queues; i++) {
 		if (i == RTE_ETHDEV_QUEUE_STAT_CNTRS)