summaryrefslogtreecommitdiff
path: root/lib/librte_mbuf
diff options
context:
space:
mode:
authorAndy Green <andy@warmcat.com>2018-05-17 21:49:27 +0800
committerThomas Monjalon <thomas@monjalon.net>2018-05-21 00:20:28 +0200
commitee07d519ceb05e59dd970c48a42cf2f09b3ac4dc (patch)
treedb36ecafd8c0f88f6865679edbdd0e5b99790df9 /lib/librte_mbuf
parente8ed5056c8747cd5d95a41749e48987ad44dc9b3 (diff)
downloaddpdk-ee07d519ceb05e59dd970c48a42cf2f09b3ac4dc.zip
dpdk-ee07d519ceb05e59dd970c48a42cf2f09b3ac4dc.tar.gz
dpdk-ee07d519ceb05e59dd970c48a42cf2f09b3ac4dc.tar.xz
mbuf: fix reference counter integer promotion
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") Cc: stable@dpdk.org Signed-off-by: Andy Green <andy@warmcat.com> Acked-by: Olivier Matz <olivier.matz@6wind.com>
Diffstat (limited to 'lib/librte_mbuf')
-rw-r--r--lib/librte_mbuf/rte_mbuf.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index eab13c6..8a2dae2 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -836,8 +836,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 __rte_mbuf_refcnt_update(m, value);
@@ -927,8 +928,9 @@ rte_mbuf_ext_refcnt_update(struct rte_mbuf_ext_shared_info *shinfo,
int16_t value)
{
if (likely(rte_mbuf_ext_refcnt_read(shinfo) == 1)) {
- rte_mbuf_ext_refcnt_set(shinfo, 1 + value);
- return 1 + value;
+ ++value;
+ rte_mbuf_ext_refcnt_set(shinfo, value);
+ return value;
}
return (uint16_t)rte_atomic16_add_return(&shinfo->refcnt_atomic, value);