[dpdk-dev] [PATCH 1/2] net/liquidioi/base: fix mbox command initialization

Shijith Thotton shijith.thotton at caviumnetworks.com
Mon Apr 10 08:26:06 CEST 2017


Initialize mail box command to request VF FLR. Data field was
uninitialized before as it was not required and caused the following
error during scan.

Reported by Coverity scan:
1384518 Uninitialized scalar variable

Fixes: cdb166963cae ("net/liquidio: add API for VF FLR")

Signed-off-by: Shijith Thotton <shijith.thotton at caviumnetworks.com>
---
 drivers/net/liquidio/base/lio_23xx_vf.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/liquidio/base/lio_23xx_vf.c b/drivers/net/liquidio/base/lio_23xx_vf.c
index 6ff5b69..e30c20d 100644
--- a/drivers/net/liquidio/base/lio_23xx_vf.c
+++ b/drivers/net/liquidio/base/lio_23xx_vf.c
@@ -31,6 +31,8 @@
  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include <string.h>
+
 #include <rte_ethdev.h>
 #include <rte_cycles.h>
 #include <rte_malloc.h>
@@ -382,7 +384,7 @@
 {
 	struct lio_mbox_cmd mbox_cmd;
 
-	mbox_cmd.msg.mbox_msg64 = 0;
+	memset(&mbox_cmd, 0, sizeof(struct lio_mbox_cmd));
 	mbox_cmd.msg.s.type = LIO_MBOX_REQUEST;
 	mbox_cmd.msg.s.resp_needed = 0;
 	mbox_cmd.msg.s.cmd = LIO_VF_FLR_REQUEST;
-- 
1.8.3.1



More information about the dev mailing list