[dpdk-stable] patch 'mbuf: fix reference counter integer promotion' has been queued to LTS release 16.11.7

luca.boccassi at gmail.com luca.boccassi at gmail.com
Wed May 23 16:33:25 CEST 2018


Hi,

FYI, your patch has been queued to LTS release 16.11.7

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 c0e0b36abbcacee75799e7c02f50e7b71edce827 Mon Sep 17 00:00:00 2001
From: Andy Green <andy at warmcat.com>
Date: Thu, 17 May 2018 21:49:27 +0800
Subject: [PATCH] mbuf: fix reference counter integer promotion

[ upstream commit ee07d519ceb05e59dd970c48a42cf2f09b3ac4dc ]

GCC 8.1 warned:

"1 + value", where value is an uint16_t causes promotion
to a signed int.  The compiler complained that we are
shoving an int into a uint16_t return type with different
size and sign.

Bumping and returning value directly instead removes the
promotion and the problem.

Fixes: f20b50b946da ("mbuf: optimize refcnt update")
Fixes: a53aa2b9f3be ("mbuf: support attaching external buffer")

Signed-off-by: Andy Green <andy at warmcat.com>
Acked-by: Olivier Matz <olivier.matz at 6wind.com>
---
 lib/librte_mbuf/rte_mbuf.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index b6a01c992..07caef69b 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -668,8 +668,9 @@ rte_mbuf_refcnt_update(struct rte_mbuf *m, int16_t value)
 	 * reference counter can occur.
 	 */
 	if (likely(rte_mbuf_refcnt_read(m) == 1)) {
-		rte_mbuf_refcnt_set(m, 1 + value);
-		return 1 + value;
+		++value;
+		rte_mbuf_refcnt_set(m, value);
+		return value;
 	}
 
 	return (uint16_t)(rte_atomic16_add_return(&m->refcnt_atomic, value));
-- 
2.14.2



More information about the stable mailing list