From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <reshmapa@ecsmtp.ir.intel.com>
Received: from mga11.intel.com (mga11.intel.com [192.55.52.93])
 by dpdk.org (Postfix) with ESMTP id A7C6EC6EC
 for <dev@dpdk.org>; Fri, 24 Jun 2016 15:55:32 +0200 (CEST)
Received: from orsmga001.jf.intel.com ([10.7.209.18])
 by fmsmga102.fm.intel.com with ESMTP; 24 Jun 2016 06:55:26 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.26,521,1459839600"; d="scan'208";a="982592168"
Received: from irvmail001.ir.intel.com ([163.33.26.43])
 by orsmga001.jf.intel.com with ESMTP; 24 Jun 2016 06:55:24 -0700
Received: from sivswdev02.ir.intel.com (sivswdev02.ir.intel.com
 [10.237.217.46])
 by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id
 u5ODtNMM003605; Fri, 24 Jun 2016 14:55:23 +0100
Received: from sivswdev02.ir.intel.com (localhost [127.0.0.1])
 by sivswdev02.ir.intel.com with ESMTP id u5ODtNJ6031199;
 Fri, 24 Jun 2016 14:55:23 +0100
Received: (from reshmapa@localhost)
 by sivswdev02.ir.intel.com with  id u5ODtNRk031195;
 Fri, 24 Jun 2016 14:55:23 +0100
From: Reshma Pattan <reshma.pattan@intel.com>
To: dev@dpdk.org
Cc: Reshma Pattan <reshma.pattan@intel.com>
Date: Fri, 24 Jun 2016 14:54:33 +0100
Message-Id: <1466776473-30883-6-git-send-email-reshma.pattan@intel.com>
X-Mailer: git-send-email 1.7.4.1
In-Reply-To: <1466776473-30883-1-git-send-email-reshma.pattan@intel.com>
References: <1466692599-26716-1-git-send-email-reshma.pattan@intel.com>
 <1466776473-30883-1-git-send-email-reshma.pattan@intel.com>
Subject: [dpdk-dev] [PATCH v4 5/5] app/pdump: fix type casting of ring size
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches and discussions about DPDK <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Fri, 24 Jun 2016 13:55:33 -0000

ring_size value is wrongly type casted to uint16_t.
It should be type casted to uint32_t, as maximum
ring size is 28bit long. Wrong type cast
wrapping around the ring size values bigger than 65535.

Fixes: caa7028276b8 ("app/pdump: add tool for packet capturing")

Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
---
 app/pdump/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/pdump/main.c b/app/pdump/main.c
index fe4d38a..2087c15 100644
--- a/app/pdump/main.c
+++ b/app/pdump/main.c
@@ -362,7 +362,7 @@ parse_pdump(const char *optarg)
 						&parse_uint_value, &v);
 		if (ret < 0)
 			goto free_kvlist;
-		pt->ring_size = (uint16_t) v.val;
+		pt->ring_size = (uint32_t) v.val;
 	} else
 		pt->ring_size = RING_SIZE;
 
-- 
2.5.0