From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Luca Boccassi <bluca@debian.org>,
Stephen Hemminger <stephen@networkplumber.org>,
Reshma Pattan <reshma.pattan@intel.com>
Subject: [PATCH] test: fix 32 bit overflow in pcapng test
Date: Thu, 18 Jul 2024 10:42:31 -0700 [thread overview]
Message-ID: <20240718174253.16346-1-stephen@networkplumber.org> (raw)
The conversion from seconds to nanoseconds in the pcapng test
would overflow on 32 bit platforms leading to this test failing.
Reported-by: Luca Boccassi <bluca@debian.org>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
app/test/test_pcapng.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/test/test_pcapng.c b/app/test/test_pcapng.c
index 89535efad0..2665b08c76 100644
--- a/app/test/test_pcapng.c
+++ b/app/test/test_pcapng.c
@@ -235,7 +235,7 @@ parse_pcap_packet(u_char *user, const struct pcap_pkthdr *h,
* but the file is open in nanonsecond mode therefore
* the timestamp is really in timespec (ie. nanoseconds).
*/
- ns = h->ts.tv_sec * NS_PER_S + h->ts.tv_usec;
+ ns = (uint64_t)h->ts.tv_sec * NS_PER_S + h->ts.tv_usec;
if (ns < ctx->start_ns || ns > ctx->end_ns) {
char tstart[128], tend[128];
--
2.43.0
next reply other threads:[~2024-07-18 17:43 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-18 17:42 Stephen Hemminger [this message]
2024-07-18 19:07 ` [PATCH] test: fix 32 bit overflow in pcapng test Luca Boccassi
2024-07-29 16:33 ` 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=20240718174253.16346-1-stephen@networkplumber.org \
--to=stephen@networkplumber.org \
--cc=bluca@debian.org \
--cc=dev@dpdk.org \
--cc=reshma.pattan@intel.com \
/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.