From 5ac8c716632fa43077b6957c65ec76e7444f6134 Mon Sep 17 00:00:00 2001 From: wangyingdong Date: Wed, 26 Jul 2023 14:44:29 +0800 Subject: [PATCH] net/ipfrag:Fixed ref not initializing warning issue CC: libssh/src/auth.c 1ipfrag/ipv4_frag.c: In function 'ipv4_fragout': ipfrag/ipv4_frag.c:224:7: error: 'ref' may be used uninitialized in this function [-Werror-maybe-uninitialized] 224 | lmemcpy(ipv4, ref, iphdrlen); ipfrag/ipv4_frag.c:364:26: note: 'ref' was declared here 364 | FAR struct ipv4_hdr_s *ref; CC: tls/task initinfo c Signed-off-by: wangyingdong --- net/ipfrag/ipv4_frag.c | 2 +- net/ipfrag/ipv6_frag.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/net/ipfrag/ipv4_frag.c b/net/ipfrag/ipv4_frag.c index acec0029a8..0d467eb60d 100644 --- a/net/ipfrag/ipv4_frag.c +++ b/net/ipfrag/ipv4_frag.c @@ -361,7 +361,7 @@ int32_t ipv4_fragout(FAR struct net_driver_s *dev, uint16_t mtu) uint16_t offset = 0; uint16_t hdrlen; FAR struct iob_s *frag; - FAR struct ipv4_hdr_s *ref; + FAR struct ipv4_hdr_s *ref = NULL; struct iob_queue_s fragq = { NULL, NULL diff --git a/net/ipfrag/ipv6_frag.c b/net/ipfrag/ipv6_frag.c index c49cc2f0b5..ab19cab73b 100644 --- a/net/ipfrag/ipv6_frag.c +++ b/net/ipfrag/ipv6_frag.c @@ -569,7 +569,7 @@ int32_t ipv6_fragout(FAR struct net_driver_s *dev, uint16_t mtu) uint16_t hdroff; uint16_t hdrtype; FAR struct iob_s *frag; - FAR struct ipv6_hdr_s *ref; + FAR struct ipv6_hdr_s *ref = NULL; FAR struct ipv6_fragment_extension_s *fraghdr; struct iob_queue_s fragq = {