diff options
author | Saul Wold <sgw@linux.intel.com> | 2012-01-27 08:51:54 -0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-02-01 15:07:41 +0000 |
commit | 9123e9eb9bf324e5cc45b535934583b0e37f378b (patch) | |
tree | 51684fc5ea3bb4a40811f3de7a22d0bcfc446828 /meta/recipes-devtools/genext2fs/genext2fs-1.4.1 | |
parent | 84e24f0f005aab7ba23bfa002a7a52785137f947 (diff) | |
download | poky-9123e9eb9bf324e5cc45b535934583b0e37f378b.tar.gz |
genext2fs: fix inode computation
This patch fixes a problem with the computation of inodes
based on the bytes_per_inode options, for a larger FS (> 2G)
the inode count would go negative and a smaller default
count would be used, this would cause the FS to run out of
inodes.
(From OE-Core rev: df5e886be059da35fb69710c79227cc768f1c58e)
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/genext2fs/genext2fs-1.4.1')
-rw-r--r-- | meta/recipes-devtools/genext2fs/genext2fs-1.4.1/fix-nbblocks-cast.patch | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/meta/recipes-devtools/genext2fs/genext2fs-1.4.1/fix-nbblocks-cast.patch b/meta/recipes-devtools/genext2fs/genext2fs-1.4.1/fix-nbblocks-cast.patch new file mode 100644 index 0000000000..3fd15e058b --- /dev/null +++ b/meta/recipes-devtools/genext2fs/genext2fs-1.4.1/fix-nbblocks-cast.patch | |||
@@ -0,0 +1,35 @@ | |||
1 | |||
2 | This patch fixes up the computation of nbinodes which would go | ||
3 | negative due to an int overflow issue when nbblocks > 2Meg for | ||
4 | a 2Gig or greater filesystem. | ||
5 | |||
6 | The computation is now done as a float equation, since both nbblocks | ||
7 | and bytes_per_inode are no floats, and then cast to int by assignment. | ||
8 | |||
9 | int tmp_nbinodes = nbblocks * BLOCKSIZE / bytes_per_inode; | ||
10 | |||
11 | Upstream-Status: Submitted | ||
12 | Signed-off-by: Saul Wold <sgw@linux.intel.com> | ||
13 | |||
14 | Index: genext2fs-1.4.1/genext2fs.c | ||
15 | =================================================================== | ||
16 | --- genext2fs-1.4.1.orig/genext2fs.c | ||
17 | +++ genext2fs-1.4.1/genext2fs.c | ||
18 | @@ -2447,7 +2447,7 @@ extern int optind, opterr, optopt; | ||
19 | int | ||
20 | main(int argc, char **argv) | ||
21 | { | ||
22 | - int nbblocks = -1; | ||
23 | + float nbblocks = -1; | ||
24 | int nbinodes = -1; | ||
25 | int nbresrvd = -1; | ||
26 | float bytes_per_inode = -1; | ||
27 | @@ -2609,7 +2609,7 @@ main(int argc, char **argv) | ||
28 | } | ||
29 | if(fs_timestamp == -1) | ||
30 | fs_timestamp = time(NULL); | ||
31 | - fs = init_fs(nbblocks, nbinodes, nbresrvd, holes, fs_timestamp); | ||
32 | + fs = init_fs((int)nbblocks, nbinodes, nbresrvd, holes, fs_timestamp); | ||
33 | } | ||
34 | |||
35 | populate_fs(fs, dopt, didx, squash_uids, squash_perms, fs_timestamp, NULL); | ||