DPDK patches and discussions
 help / color / mirror / Atom feed
From: Remy Horton <remy.horton@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH v1 2/2] examples/l2fwd-keepalive: Fix integer overflow
Date: Thu, 10 Dec 2015 09:50:07 +0000	[thread overview]
Message-ID: <1449741007-1022-3-git-send-email-remy.horton@intel.com> (raw)
In-Reply-To: <1449741007-1022-1-git-send-email-remy.horton@intel.com>

Fix Coverity warning with potential 32-bit integer multiplication overflow
where final result is expected to be 64-bit.

>>> CID 120144 (#1 of 1): Unintentional integer overflow (OVERFLOW_BEFORE_WIDEN)

Fixes: e64833f2273a ("examples/l2fwd-keepalive: add sample application")

Signed-off-by: Remy Horton <remy.horton@intel.com>
---
 examples/l2fwd-keepalive/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/examples/l2fwd-keepalive/main.c b/examples/l2fwd-keepalive/main.c
index 8d7b09e..f4d52f2 100644
--- a/examples/l2fwd-keepalive/main.c
+++ b/examples/l2fwd-keepalive/main.c
@@ -471,7 +471,7 @@ l2fwd_parse_args(int argc, char **argv)
 		/* timer period */
 		case 'T':
 			timer_period = l2fwd_parse_timer_period(optarg)
-				* 1000 * TIMER_MILLISECOND;
+				* (int64_t)(1000 * TIMER_MILLISECOND);
 			if (timer_period < 0) {
 				printf("invalid timer period\n");
 				l2fwd_usage(prgname);
-- 
1.9.3

  parent reply	other threads:[~2015-12-10  9:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-10  9:50 [dpdk-dev] [PATCH v1 0/2] Fix various Coverity warnings Remy Horton
2015-12-10  9:50 ` [dpdk-dev] [PATCH v1 1/2] examples/ethtool: Fix uninitialised variable Remy Horton
2015-12-10 10:20   ` Mcnamara, John
2015-12-10  9:50 ` Remy Horton [this message]
2015-12-10 10:20   ` [dpdk-dev] [PATCH v1 2/2] examples/l2fwd-keepalive: Fix integer overflow Mcnamara, John
2015-12-10 21:27 ` [dpdk-dev] [PATCH v1 0/2] Fix various Coverity warnings 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=1449741007-1022-3-git-send-email-remy.horton@intel.com \
    --to=remy.horton@intel.com \
    --cc=dev@dpdk.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).