All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
	Konstantin Ananyev <konstantin.v.ananyev@yandex.ru>
Subject: [RFC 4/8] test/ipfrag: fix gcc-12 warnings
Date: Tue,  7 Jun 2022 10:17:42 -0700	[thread overview]
Message-ID: <20220607171746.461772-5-stephen@networkplumber.org> (raw)
In-Reply-To: <20220607171746.461772-1-stephen@networkplumber.org>

Using rte_memcpy is not necessary here. It also causes warnings
from derefencing past end of input.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 app/test/test_ipfrag.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/app/test/test_ipfrag.c b/app/test/test_ipfrag.c
index dc62b0e5475b..ba0ffd080604 100644
--- a/app/test/test_ipfrag.c
+++ b/app/test/test_ipfrag.c
@@ -23,7 +23,6 @@ test_ipfrag(void)
 
 #include <rte_ip_frag.h>
 #include <rte_mbuf.h>
-#include <rte_memcpy.h>
 #include <rte_random.h>
 
 #define NUM_MBUFS 128
@@ -147,13 +146,13 @@ test_get_ipv4_opt(bool is_first_frag, bool opt_copied,
 		if (opt_copied) {
 			expected_opt->len =
 				sizeof(expected_first_frag_ipv4_opts_copied);
-			rte_memcpy(expected_opt->data,
+			memcpy(expected_opt->data,
 				expected_first_frag_ipv4_opts_copied,
 				sizeof(expected_first_frag_ipv4_opts_copied));
 		} else {
 			expected_opt->len =
 				sizeof(expected_first_frag_ipv4_opts_nocopied);
-			rte_memcpy(expected_opt->data,
+			memcpy(expected_opt->data,
 				expected_first_frag_ipv4_opts_nocopied,
 				sizeof(expected_first_frag_ipv4_opts_nocopied));
 		}
@@ -161,13 +160,13 @@ test_get_ipv4_opt(bool is_first_frag, bool opt_copied,
 		if (opt_copied) {
 			expected_opt->len =
 				sizeof(expected_sub_frag_ipv4_opts_copied);
-			rte_memcpy(expected_opt->data,
+			memcpy(expected_opt->data,
 				expected_sub_frag_ipv4_opts_copied,
 				sizeof(expected_sub_frag_ipv4_opts_copied));
 		} else {
 			expected_opt->len =
 				sizeof(expected_sub_frag_ipv4_opts_nocopied);
-			rte_memcpy(expected_opt->data,
+			memcpy(expected_opt->data,
 				expected_sub_frag_ipv4_opts_nocopied,
 				sizeof(expected_sub_frag_ipv4_opts_nocopied));
 		}
@@ -227,7 +226,7 @@ v4_allocate_packet_of(struct rte_mbuf *b, int fill, size_t s,
 	hdr->src_addr = rte_cpu_to_be_32(0x8080808);
 	hdr->dst_addr = rte_cpu_to_be_32(0x8080404);
 
-	rte_memcpy(hdr + 1, opt.data, opt.len);
+	memcpy(hdr + 1, opt.data, opt.len);
 }
 
 static void
@@ -312,7 +311,7 @@ test_get_frag_opt(struct rte_mbuf **mb, int32_t num,
 				char *iph_opt = rte_pktmbuf_mtod_offset(mb[i],
 				    char *, sizeof(struct rte_ipv4_hdr));
 				opt->len = opt_len;
-				rte_memcpy(opt->data, iph_opt, opt_len);
+				memcpy(opt->data, iph_opt, opt_len);
 			} else {
 				opt->len = RTE_IPV4_HDR_OPT_MAX_LEN;
 				memset(opt->data, RTE_IPV4_HDR_OPT_EOL,
-- 
2.35.1


  parent reply	other threads:[~2022-06-07 17:18 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-07 17:17 [RFC 0/8] Gcc-12 warning fixes Stephen Hemminger
2022-06-07 17:17 ` [RFC 1/8] net/ena: fix warnings related to rte_memcpy and gcc-12 Stephen Hemminger
2022-06-08 12:29   ` Michał Krawczyk
2022-06-08 15:32     ` Stephen Hemminger
2022-06-08 19:18       ` Michał Krawczyk
2022-06-08 20:52         ` Stephen Hemminger
2022-06-07 17:17 ` [RFC 2/8] net/qede: fix gcc-12 rte_memcpy warnings Stephen Hemminger
2022-06-23 14:16   ` David Marchand
2022-06-07 17:17 ` [RFC 3/8] net/ice: fix rte_memcpy warnings with gcc-12 Stephen Hemminger
2022-06-07 17:17 ` Stephen Hemminger [this message]
2022-06-07 17:17 ` [RFC 5/8] test/ipsec: fix gcc-12 rte_memcpy warnings Stephen Hemminger
2022-06-07 17:17 ` [RFC 6/8] net/enetfc: fix array out of bounds warning Stephen Hemminger
2022-06-07 17:17 ` [RFC 7/8] vhost: replace rte_memcpy to fix warning Stephen Hemminger
2022-06-07 17:17 ` [RFC 8/8] ip_frag: fix gcc-12 warnings Stephen Hemminger
2022-06-08  8:19   ` Konstantin Ananyev
2022-06-08 15:26     ` Stephen Hemminger
2022-06-09  7:09       ` Morten Brørup
2022-06-14 21:20         ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220607171746.461772-5-stephen@networkplumber.org \
    --to=stephen@networkplumber.org \
    --cc=dev@dpdk.org \
    --cc=konstantin.v.ananyev@yandex.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.