lkml.org 
[lkml]   [2018]   [Jul]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] dlm: use 64-bit arithmetic instead of 32-bit
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
\
 
 \ /
  Last update: 2018-07-04 16:44    [W:0.029 / U:0.096 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site