On Fri, 28 Jun 2019 06:13:09 +0300 Ivan Malov <ivan.ma...@oktetlabs.ru> wrote:
> The API to prepare checksum offloads mistreats L4 > checksum type enum values as self-contained flags. > > Turning these flag checks into enum checks causes > warnings by GCC about possibly uninitialised IPv4 > header pointer. The issue was found to show up in > the case of GCC versions 4.8.5 and 5.4.0, however, > it might be the case for a wider variety of other > versions. Initialise the pointer upon declaration. > and explain the reason behind this in the comment. > > Fixes: 4fb7e803eb1a ("ethdev: add Tx preparation") > Cc: Tomasz Kulasek <tomaszx.kula...@intel.com> > Cc: sta...@dpdk.org > > Signed-off-by: Ivan Malov <ivan.ma...@oktetlabs.ru> > Reviewed-by: Andrew Rybchenko <arybche...@solarflare.com> > --- > lib/librte_net/rte_net.h | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/lib/librte_net/rte_net.h b/lib/librte_net/rte_net.h > index 7be69f8..d240206 100644 > --- a/lib/librte_net/rte_net.h > +++ b/lib/librte_net/rte_net.h > @@ -112,7 +112,8 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, > static inline int > rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags) > { > - struct rte_ipv4_hdr *ipv4_hdr; > + /* Initialise ipv4_hdr to avoid false positive compiler warnings. */ > + struct rte_ipv4_hdr *ipv4_hdr = NULL; > struct rte_ipv6_hdr *ipv6_hdr; Looks good, a smart compiler will just drop it. Acked-by: Stephen Hemminger <step...@networkplumber.org>