summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/recipes-devtools/genext2fs/genext2fs-1.4.1/fix-nbblocks-cast.patch35
-rw-r--r--meta/recipes-devtools/genext2fs/genext2fs_1.4.1.bb4
2 files changed, 38 insertions, 1 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
2This patch fixes up the computation of nbinodes which would go
3negative due to an int overflow issue when nbblocks > 2Meg for
4a 2Gig or greater filesystem.
5
6The computation is now done as a float equation, since both nbblocks
7and bytes_per_inode are no floats, and then cast to int by assignment.
8
9int tmp_nbinodes = nbblocks * BLOCKSIZE / bytes_per_inode;
10
11Upstream-Status: Submitted
12Signed-off-by: Saul Wold <sgw@linux.intel.com>
13
14Index: 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);
diff --git a/meta/recipes-devtools/genext2fs/genext2fs_1.4.1.bb b/meta/recipes-devtools/genext2fs/genext2fs_1.4.1.bb
index 9364bb895f..012ec6c4fb 100644
--- a/meta/recipes-devtools/genext2fs/genext2fs_1.4.1.bb
+++ b/meta/recipes-devtools/genext2fs/genext2fs_1.4.1.bb
@@ -1,6 +1,8 @@
1require genext2fs.inc 1require genext2fs.inc
2 2
3PR = "r0" 3PR = "r1"
4
5SRC_URI += "file://fix-nbblocks-cast.patch"
4 6
5SRC_URI[md5sum] = "b7b6361bcce2cedff1ae437fadafe53b" 7SRC_URI[md5sum] = "b7b6361bcce2cedff1ae437fadafe53b"
6SRC_URI[sha256sum] = "404dbbfa7a86a6c3de8225c8da254d026b17fd288e05cec4df2cc7e1f4feecfc" 8SRC_URI[sha256sum] = "404dbbfa7a86a6c3de8225c8da254d026b17fd288e05cec4df2cc7e1f4feecfc"