summaryrefslogtreecommitdiffstats
path: root/fs/ubifs/io.c
diff options
context:
space:
mode:
authorAdrian Hunter <adrian.hunter@nokia.com>2009-06-22 16:31:09 +0200
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2009-07-05 17:45:15 +0200
commite3dc5a665d39112e98cfd5bbc7fda2963c00c12c (patch)
treeb4f4c2ecec85bfb029f4ec31c56bb7477a86aba1 /fs/ubifs/io.c
parentLinux 2.6.31-rc2 (diff)
downloadlinux-e3dc5a665d39112e98cfd5bbc7fda2963c00c12c.tar.xz
linux-e3dc5a665d39112e98cfd5bbc7fda2963c00c12c.zip
UBIFS: fix integer overflow warning
Fix the following warning: fs/ubifs/io.c: In function 'ubifs_wbuf_init': fs/ubifs/io.c:860: warning: integer overflow in expression And limit maximum hrtimer delta to ULONG_MAX because the argument is 'unsigned long'. Signed-off-by: Adrian Hunter <adrian.hunter@nokia.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'fs/ubifs/io.c')
-rw-r--r--fs/ubifs/io.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/ubifs/io.c b/fs/ubifs/io.c
index bc5857199ec2..2d41ae1d6607 100644
--- a/fs/ubifs/io.c
+++ b/fs/ubifs/io.c
@@ -857,7 +857,9 @@ int ubifs_wbuf_init(struct ubifs_info *c, struct ubifs_wbuf *wbuf)
* and hard limits.
*/
hardlimit = ktime_set(DEFAULT_WBUF_TIMEOUT_SECS, 0);
- wbuf->delta = (DEFAULT_WBUF_TIMEOUT_SECS * NSEC_PER_SEC) * 2 / 10;
+ wbuf->delta = DEFAULT_WBUF_TIMEOUT_SECS * 1000000000ULL * 2 / 10;
+ if (wbuf->delta > ULONG_MAX)
+ wbuf->delta = ULONG_MAX;
wbuf->softlimit = ktime_sub_ns(hardlimit, wbuf->delta);
hrtimer_set_expires_range_ns(&wbuf->timer, wbuf->softlimit,
wbuf->delta);