public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Kevin Cernekee <cernekee@gmail.com>
To: <dwmw2@infradead.org>, <dedekind@infradead.org>
Cc: <linux-mtd@lists.infradead.org>, <linux-kernel@vger.kernel.org>
Subject: [PATCH] UBIFS: Fix integer overflow warnings
Date: Fri, 26 Jun 2009 17:10:50 -0700	[thread overview]
Message-ID: <3f15c0091535d0ab4a1d45cbc9eb3667@localhost> (raw)

This warning was observed on MIPS32 using 2.6.31-rc1 and gcc-4.2.0:

fs/ubifs/io.c: In function 'ubifs_wbuf_init':
fs/ubifs/io.c:860: warning: integer overflow in expression
fs/ubifs/io.c:860: warning: integer overflow in expression
fs/ubifs/io.c:860: warning: integer overflow in expression

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
---
index bc58571..184157e 100644
--- a/fs/ubifs/io.c
+++ b/fs/ubifs/io.c
@@ -857,7 +857,8 @@ 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 = ((unsigned long long)DEFAULT_WBUF_TIMEOUT_SECS *
+		       NSEC_PER_SEC) * 2 / 10;
 	wbuf->softlimit = ktime_sub_ns(hardlimit, wbuf->delta);
 	hrtimer_set_expires_range_ns(&wbuf->timer,  wbuf->softlimit,
 				     wbuf->delta);
--

             reply	other threads:[~2009-06-27  0:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-27  0:10 Kevin Cernekee [this message]
2009-06-27 11:37 ` [PATCH] UBIFS: Fix integer overflow warnings Artem Bityutskiy

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=3f15c0091535d0ab4a1d45cbc9eb3667@localhost \
    --to=cernekee@gmail.com \
    --cc=dedekind@infradead.org \
    --cc=dwmw2@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    /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