[dpdk-stable] patch 'net/mlx4: fix shifts of signed values in Tx' has been queued to stable release 18.02.2

luca.boccassi at gmail.com luca.boccassi at gmail.com
Wed May 23 14:09:18 CEST 2018


Hi,

FYI, your patch has been queued to stable release 18.02.2

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 05/25/18. So please
shout if anyone has objections.

Thanks.

Luca Boccassi

---
>From dc32ae8e71017a3d7a0fd0016fa02656668ac058 Mon Sep 17 00:00:00 2001
From: Adrien Mazarguil <adrien.mazarguil at 6wind.com>
Date: Wed, 16 May 2018 18:20:54 +0200
Subject: [PATCH] net/mlx4: fix shifts of signed values in Tx

[ upstream commit 911bbb0f7cae2c182471bebb4d72895083ce9fb9 ]

This patch addresses the following issues reported by cppcheck:

 [drivers/net/mlx4/mlx4_rxtx.c:266]: (error) Shifting signed 32-bit value
     by 31 bits is undefined behaviour
 [drivers/net/mlx4/mlx4_rxtx.c:624]: (error) Shifting signed 32-bit value
     by 31 bits is undefined behaviour
 [drivers/net/mlx4/mlx4_txq.c:89]: (error) Shifting signed 32-bit value by
     31 bits is undefined behaviour
 [drivers/net/mlx4/mlx4_txq.c:91]: (error) Shifting signed 32-bit value by
     31 bits is undefined behaviour

Fixes: 78e81a9844f8 ("net/mlx4: merge Tx queue rings management")

Reported-by: Ferruh Yigit <ferruh.yigit at intel.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil at 6wind.com>
---
 drivers/net/mlx4/mlx4_rxtx.c | 4 ++--
 drivers/net/mlx4/mlx4_txq.c  | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/mlx4/mlx4_rxtx.c b/drivers/net/mlx4/mlx4_rxtx.c
index 8ca8b77cc..0cff1067f 100644
--- a/drivers/net/mlx4/mlx4_rxtx.c
+++ b/drivers/net/mlx4/mlx4_rxtx.c
@@ -263,7 +263,7 @@ mlx4_txq_stamp_freed_wqe(struct mlx4_sq *sq, volatile uint32_t *start,
 		} while (start != (volatile uint32_t *)sq->eob);
 		start = (volatile uint32_t *)sq->buf;
 		/* Flip invalid stamping ownership. */
-		stamp ^= RTE_BE32(0x1 << MLX4_SQ_OWNER_BIT);
+		stamp ^= RTE_BE32(1u << MLX4_SQ_OWNER_BIT);
 		sq->stamp = stamp;
 		if (start == end)
 			return size;
@@ -639,7 +639,7 @@ mlx4_tx_burst(void *dpdk_txq, struct rte_mbuf **pkts, uint16_t pkts_n)
 			ctrl_next = (volatile struct mlx4_wqe_ctrl_seg *)
 				((volatile uint8_t *)ctrl_next - sq->size);
 			/* Flip HW valid ownership. */
-			sq->owner_opcode ^= 0x1 << MLX4_SQ_OWNER_BIT;
+			sq->owner_opcode ^= 1u << MLX4_SQ_OWNER_BIT;
 		}
 		/*
 		 * For raw Ethernet, the SOLICIT flag is used to indicate
diff --git a/drivers/net/mlx4/mlx4_txq.c b/drivers/net/mlx4/mlx4_txq.c
index 071b2d5d8..d1977a735 100644
--- a/drivers/net/mlx4/mlx4_txq.c
+++ b/drivers/net/mlx4/mlx4_txq.c
@@ -144,9 +144,9 @@ mlx4_txq_fill_dv_obj_info(struct txq *txq, struct mlx4dv_obj *mlxdv)
 	uint32_t headroom_size = 2048 + (1 << dqp->sq.wqe_shift);
 	/* Continuous headroom size bytes must always stay freed. */
 	sq->remain_size = sq->size - headroom_size;
-	sq->owner_opcode = MLX4_OPCODE_SEND | (0 << MLX4_SQ_OWNER_BIT);
+	sq->owner_opcode = MLX4_OPCODE_SEND | (0u << MLX4_SQ_OWNER_BIT);
 	sq->stamp = rte_cpu_to_be_32(MLX4_SQ_STAMP_VAL |
-				     (0 << MLX4_SQ_OWNER_BIT));
+				     (0u << MLX4_SQ_OWNER_BIT));
 	sq->db = dqp->sdb;
 	sq->doorbell_qpn = dqp->doorbell_qpn;
 	cq->buf = dcq->buf.buf;
-- 
2.14.2



More information about the stable mailing list