From: Andre Muezerie <andremue@linux.microsoft.com>
To: Konstantin Ananyev <konstantin.v.ananyev@yandex.ru>
Cc: dev@dpdk.org, Andre Muezerie <andremue@linux.microsoft.com>
Subject: [PATCH] test_ipfrag: remove array of size zero
Date: Thu, 6 Mar 2025 18:13:01 -0800 [thread overview]
Message-ID: <1741313581-14300-1-git-send-email-andremue@linux.microsoft.com> (raw)
When compiling with MSVC the error below pops up:
../app/test/test_ipfrag.c(39): error C2466:
cannot allocate an array of constant size 0
../app/test/test_ipfrag.c(157): warning C4034: sizeof returns 0
../app/test/test_ipfrag.c(160): warning C4034: sizeof returns 0
The fix is to simplify the code and remove the zero-size array.
Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
---
app/test/test_ipfrag.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/app/test/test_ipfrag.c b/app/test/test_ipfrag.c
index 18d6727157..95d7952b4d 100644
--- a/app/test/test_ipfrag.c
+++ b/app/test/test_ipfrag.c
@@ -36,8 +36,6 @@ uint8_t expected_first_frag_ipv4_opts_nocopied[] = {
0x00, 0x00, 0x00, 0x00,
};
-uint8_t expected_sub_frag_ipv4_opts_nocopied[0];
-
struct test_opt_data {
bool is_first_frag; /**< offset is 0 */
bool opt_copied; /**< ip option copied flag */
@@ -153,11 +151,8 @@ test_get_ipv4_opt(bool is_first_frag, bool opt_copied,
expected_sub_frag_ipv4_opts_copied,
sizeof(expected_sub_frag_ipv4_opts_copied));
} else {
- expected_opt->len =
- sizeof(expected_sub_frag_ipv4_opts_nocopied);
- memcpy(expected_opt->data,
- expected_sub_frag_ipv4_opts_nocopied,
- sizeof(expected_sub_frag_ipv4_opts_nocopied));
+ expected_opt->len = 0;
+ /* No data to be copied */
}
}
}
--
2.48.1.vfs.0.0
next reply other threads:[~2025-03-07 2:13 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-07 2:13 Andre Muezerie [this message]
2025-05-16 9:17 ` [PATCH] test_ipfrag: remove array of size zero David Marchand
2025-05-16 13:18 ` David Marchand
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=1741313581-14300-1-git-send-email-andremue@linux.microsoft.com \
--to=andremue@linux.microsoft.com \
--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.