aboutsummaryrefslogtreecommitdiff
path: root/libflash/libffs.c
diff options
context:
space:
mode:
authorMichael Neuling <mikey@neuling.org>2016-07-28 17:15:32 +1000
committerStewart Smith <stewart@linux.vnet.ibm.com>2016-08-02 18:12:49 +1000
commitc043065cf92358104e617b5c6aabbe619de76b0b (patch)
tree8f523164baeb14c937ae71f549ae5daa438a1b6c /libflash/libffs.c
parent17c22dbd6b011211a040dc2839d2e3e560fa0806 (diff)
downloadskiboot-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 'libflash/libffs.c')
-rw-r--r--libflash/libffs.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libflash/libffs.c b/libflash/libffs.c
index 8134962..65c3fbe 100644
--- a/libflash/libffs.c
+++ b/libflash/libffs.c
@@ -78,7 +78,7 @@ int ffs_init(uint32_t offset, uint32_t max_size, struct blocklevel_device *bl,
struct ffs_hdr hdr;
struct ffs_hdr blank_hdr;
struct ffs_handle *f;
- uint32_t total_size;
+ uint64_t total_size;
int rc, i;
if (!ffs || !bl)
@@ -90,6 +90,8 @@ int ffs_init(uint32_t offset, uint32_t max_size, struct blocklevel_device *bl,
FL_ERR("FFS: Error %d retrieving flash info\n", rc);
return rc;
}
+ if (total_size > UINT_MAX)
+ return FLASH_ERR_VERIFY_FAILURE;
if ((offset + max_size) < offset)
return FLASH_ERR_PARM_ERROR;