public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] UBIFS: Fix integer overflow warnings
@ 2009-06-27  0:10 Kevin Cernekee
  2009-06-27 11:37 ` Artem Bityutskiy
  0 siblings, 1 reply; 2+ messages in thread
From: Kevin Cernekee @ 2009-06-27  0:10 UTC (permalink / raw)
  To: dwmw2, dedekind; +Cc: linux-mtd, linux-kernel

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);
--

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] UBIFS: Fix integer overflow warnings
  2009-06-27  0:10 [PATCH] UBIFS: Fix integer overflow warnings Kevin Cernekee
@ 2009-06-27 11:37 ` Artem Bityutskiy
  0 siblings, 0 replies; 2+ messages in thread
From: Artem Bityutskiy @ 2009-06-27 11:37 UTC (permalink / raw)
  To: Kevin Cernekee; +Cc: dwmw2, linux-mtd, linux-kernel

On Fri, 2009-06-26 at 17:10 -0700, Kevin Cernekee wrote:
> 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>

Thanks for the patch,

however we there is already a fix for this. I'll send it to
Linus soon.

http://git.infradead.org/ubifs-2.6.git?a=commit;h=4804e8b700504978eb4b9397f818ba7ba1227a15

-- 
Best regards,
Artem Bityutskiy (Битюцкий Артём)


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-06-27 11:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-27  0:10 [PATCH] UBIFS: Fix integer overflow warnings Kevin Cernekee
2009-06-27 11:37 ` Artem Bityutskiy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox