diff options
author | Michael Neuling <mikey@neuling.org> | 2016-07-28 17:15:32 +1000 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2016-08-02 18:12:49 +1000 |
commit | c043065cf92358104e617b5c6aabbe619de76b0b (patch) | |
tree | 8f523164baeb14c937ae71f549ae5daa438a1b6c /external | |
parent | 17c22dbd6b011211a040dc2839d2e3e560fa0806 (diff) | |
download | skiboot-c043065cf92358104e617b5c6aabbe619de76b0b.zip skiboot-c043065cf92358104e617b5c6aabbe619de76b0b.tar.gz skiboot-c043065cf92358104e617b5c6aabbe619de76b0b.tar.bz2 |
flash: Make size 64 bit safe
This makes the size of flash 64 bit safe so that we can have flash
devices greater than 4GB. This is especially useful for mambo disks
passed through to Linux.
Fortunately the device tree interface and the linux device driver are
64bit safe so no changes are required there.
Userspace gard and flash tools are also updated to ensure "make check"
still passes.
Signed-off-by: Michael Neuling <mikey@neuling.org>
Reviewed-by: Cyril Bur <cyrilbur@gmail.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'external')
-rw-r--r-- | external/gard/gard.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/external/gard/gard.c b/external/gard/gard.c index 9da7496..7ec52d8 100644 --- a/external/gard/gard.c +++ b/external/gard/gard.c @@ -575,6 +575,7 @@ int main(int argc, char **argv) const char *action, *progname; char *filename = NULL; struct gard_ctx _ctx, *ctx; + uint64_t bl_size; int rc, i = 0; bool part = 0; bool ecc = 0; @@ -643,10 +644,18 @@ int main(int argc, char **argv) goto out_free; } - rc = blocklevel_get_info(ctx->bl, NULL, &(ctx->f_size), NULL); + rc = blocklevel_get_info(ctx->bl, NULL, &bl_size, NULL); if (rc) goto out; + if (bl_size > UINT_MAX) { + fprintf(stderr, "MTD device bigger than %i: size:%lu\n", + UINT_MAX, bl_size); + rc = EXIT_FAILURE; + goto out; + } + ctx->f_size = bl_size; + if (!part) { rc = ffs_init(0, ctx->f_size, ctx->bl, &ctx->ffs, 1); if (rc) |