cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Gustavo A. R. Silva <gustavo@embeddedor.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH] dlm: use 64-bit arithmetic instead of 32-bit
Date: Wed, 4 Jul 2018 09:43:49 -0500	[thread overview]
Message-ID: <20180704144349.GA13170@embeddedor.com> (raw)

Add suffix LL to constant 10000 in order to give the compiler
complete information about the proper arithmetic to use.

Notice that such constant is used in a context that expects an
expression of type s64 (64 bits, signed) and the following
expression is currently being evaluated using 32-bit arithmetic:

dlm_config.ci_timewarn_cs * 10000

Addresses-Coverity-ID: 200667 ("Unintentional integer overflow")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
 fs/dlm/lock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/dlm/lock.c b/fs/dlm/lock.c
index cc91963..a3939b2 100644
--- a/fs/dlm/lock.c
+++ b/fs/dlm/lock.c
@@ -1876,7 +1876,7 @@ void dlm_scan_timeout(struct dlm_ls *ls)
 				do_cancel = 1;
 
 			if ((lkb->lkb_flags & DLM_IFL_WATCH_TIMEWARN) &&
-			    wait_us >= dlm_config.ci_timewarn_cs * 10000)
+			    wait_us >= dlm_config.ci_timewarn_cs * 10000LL)
 				do_warn = 1;
 
 			if (!do_cancel && !do_warn)
-- 
2.7.4



                 reply	other threads:[~2018-07-04 14:43 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20180704144349.GA13170@embeddedor.com \
    --to=gustavo@embeddedor.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 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).