[dpdk-dev,v5,5/5] app/pdump: fix type casting of ring size

Message ID 1466786183-3772-6-git-send-email-reshma.pattan@intel.com (mailing list archive)
State Accepted, archived
Headers

Commit Message

Pattan, Reshma June 24, 2016, 4:36 p.m. UTC
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(-)
  

Comments

Mcnamara, John June 24, 2016, 10:51 p.m. UTC | #1
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Reshma Pattan
> Sent: Friday, June 24, 2016 5:36 PM
> To: dev@dpdk.org
> Cc: Pattan, Reshma <reshma.pattan@intel.com>
> Subject: [dpdk-dev] [PATCH v5 5/5] app/pdump: fix type casting of ring
> size
> 
> 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>

Acked-by: John McNamara <john.mcnamara@intel.com>
  

Patch

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;