From: Adrian Hunter Date: Mon, 22 Jun 2009 14:31:09 +0000 (+0300) Subject: UBIFS: fix integer overflow warning X-Git-Tag: v2.6.31-rc3~22^2~13 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e3dc5a665d39112e98cfd5bbc7fda2963c00c12c;p=platform%2Fupstream%2Fkernel-adaptation-pc.git 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 Signed-off-by: Artem Bityutskiy --- diff --git a/fs/ubifs/io.c b/fs/ubifs/io.c index bc58571..2d41ae1 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);