app/testpmd: fix error definition type

Message ID 20211027020152.1928220-1-jie1x.wang@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series app/testpmd: fix error definition type |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/github-robot: build success github build: passed
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS

Commit Message

Jie Wang Oct. 27, 2021, 2:01 a.m. UTC
  In "msg_type |= 0xc800", wider "51200" has high-order bits (0xc800)
that don't affect the narrower left-hand side.

This patch fixs coverity issue by changing the definition type of
"msg_type" from uint8_t to uint16_t.

Coverity issue: 373651
Fixes: 748530f0354e ("app/testpmd: support L2TPv2 and PPP protocol pattern")

Signed-off-by: Jie Wang <jie1x.wang@intel.com>
---
 app/test-pmd/cmdline_flow.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Ferruh Yigit Oct. 28, 2021, 6:04 p.m. UTC | #1
On 10/27/2021 3:01 AM, Jie Wang wrote:
> In "msg_type |= 0xc800", wider "51200" has high-order bits (0xc800)
> that don't affect the narrower left-hand side.
> 
> This patch fixs coverity issue by changing the definition type of
> "msg_type" from uint8_t to uint16_t.
> 
> Coverity issue: 373651
> Fixes: 748530f0354e ("app/testpmd: support L2TPv2 and PPP protocol pattern")
> 
> Signed-off-by: Jie Wang <jie1x.wang@intel.com>

Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>

Applied to dpdk-next-net/main, thanks.
  

Patch

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index d8218771fb..24b224e632 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -5880,7 +5880,7 @@  parse_vc_item_l2tpv2_type(struct context *ctx, const struct token *token,
 	struct rte_flow_item_l2tpv2 *l2tpv2_mask;
 	struct rte_flow_item *item;
 	uint32_t data_size;
-	uint8_t msg_type = 0;
+	uint16_t msg_type = 0;
 	struct buffer *out = buf;
 	const struct arg *arg;