public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] UBIFS: fix the dark space calculation
@ 2011-08-26 10:38 srimugunthan dhandapani
  2011-09-11 11:10 ` Artem Bityutskiy
  0 siblings, 1 reply; 2+ messages in thread
From: srimugunthan dhandapani @ 2011-08-26 10:38 UTC (permalink / raw)
  To: linux-mtd

hi,
The dark space calculation should be 64 bit type-casted ,when
assigning to tmp64( similar to how total_free is calculated).
Overflow will occur for very large flashes.

Signed-off-by: srimugunthan <srimugunthan.dhandapani@gmail.com>
---
diff --git a/fs/ubifs/sb.c b/fs/ubifs/sb.c
index 93d938a..6094c5a 100644
--- a/fs/ubifs/sb.c
+++ b/fs/ubifs/sb.c
@@ -247,7 +247,7 @@ static int create_default_filesystem(struct ubifs_info *c)
        mst->total_dirty = cpu_to_le64(tmp64);

        /*  The indexing LEB does not contribute to dark space */
-       tmp64 = (c->main_lebs - 1) * c->dark_wm;
+       tmp64 = ((long long)(c->main_lebs - 1) * c->dark_wm);
        mst->total_dark = cpu_to_le64(tmp64);

        mst->total_used = cpu_to_le64(UBIFS_INO_NODE_SZ);
--

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

* Re: [PATCH] UBIFS: fix the dark space calculation
  2011-08-26 10:38 [PATCH] UBIFS: fix the dark space calculation srimugunthan dhandapani
@ 2011-09-11 11:10 ` Artem Bityutskiy
  0 siblings, 0 replies; 2+ messages in thread
From: Artem Bityutskiy @ 2011-09-11 11:10 UTC (permalink / raw)
  To: srimugunthan dhandapani; +Cc: linux-mtd

On Fri, 2011-08-26 at 16:08 +0530, srimugunthan dhandapani wrote:
> hi,
> The dark space calculation should be 64 bit type-casted ,when
> assigning to tmp64( similar to how total_free is calculated).
> Overflow will occur for very large flashes.

The patch did not apply to the latest UBIFS, but I have amended it.
Pushed to ubifs-2.6.git, thanks!

-- 
Best Regards,
Artem Bityutskiy

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

end of thread, other threads:[~2011-09-11 11:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-26 10:38 [PATCH] UBIFS: fix the dark space calculation srimugunthan dhandapani
2011-09-11 11:10 ` Artem Bityutskiy

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