mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-18 22:14:16 +00:00
UBIFS: fix the dark space calculation
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> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
This commit is contained in:
parent
d37854cf99
commit
7606f85a70
2 changed files with 2 additions and 2 deletions
|
@ -983,7 +983,7 @@ int ubifs_recover_inl_heads(struct ubifs_info *c, void *sbuf)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* clean_an_unclean_leb - read and write a LEB to remove corruption.
|
* clean_an_unclean_leb - read and write a LEB to remove corruption.
|
||||||
* @c: UBIFS file-system description object
|
* @c: UBIFS file-system description object
|
||||||
* @ucleb: unclean LEB information
|
* @ucleb: unclean LEB information
|
||||||
* @sbuf: LEB-sized buffer to use
|
* @sbuf: LEB-sized buffer to use
|
||||||
|
|
|
@ -247,7 +247,7 @@ static int create_default_filesystem(struct ubifs_info *c)
|
||||||
mst->total_dirty = cpu_to_le64(tmp64);
|
mst->total_dirty = cpu_to_le64(tmp64);
|
||||||
|
|
||||||
/* The indexing LEB does not contribute to dark space */
|
/* 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_dark = cpu_to_le64(tmp64);
|
||||||
|
|
||||||
mst->total_used = cpu_to_le64(UBIFS_INO_NODE_SZ);
|
mst->total_used = cpu_to_le64(UBIFS_INO_NODE_SZ);
|
||||||
|
|
Loading…
Add table
Reference in a new issue