mbuf: avoid integer promotion in prepend/adj/chain
GCC 8.1 warned:
In function 'rte_pktmbuf_prepend':
rte_mbuf.h:1908:17: warning: conversion from 'int' to 'uint16_t'
{aka 'short unsigned int'} may change value [-Wconversion]
m->data_off -= len;
^~~
m->data_off is a uint16_t
uint16_t data_off;
len (a uint16_t) is promoted to an int using -=. Do the
subtraction explicitly and cast the result to uint16_t.
The below += or -= changes are solving the same thing.
In function 'rte_pktmbuf_adj':
rte_mbuf.h:1969:17: warning: conversion from 'int' to 'uint16_t'
{aka 'short unsigned int'} may change value [-Wconversion]
m->data_off += len;
^~~
In function 'rte_pktmbuf_chain':
rte_mbuf.h:2082:19: warning: conversion from 'int' to 'uint16_t'
{aka 'short unsigned int'} may change value [-Wconversion]
head->nb_segs += tail->nb_segs;
^~~~
Also uint16_t
uint16_t nb_segs; /**< Number of segments. */
Fixes:
08b563ffb19d ("mbuf: replace data pointer by an offset")
Fixes:
1a60a0daa6e4 ("mbuf: fix segments number type increase")
Cc: stable@dpdk.org
Signed-off-by: Andy Green <andy@warmcat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>