Skip to content

Commit

Permalink
UBIFS: fix integer overflow warning
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Adrian Hunter authored and Artem Bityutskiy committed Jul 5, 2009
1 parent 8e4a718 commit e3dc5a6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion fs/ubifs/io.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit e3dc5a6

Please sign in to comment.