summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/ext4/ext4_journal.c7
-rw-r--r--fs/ext4/ext4fs.c13
-rw-r--r--fs/fat/fat.c1
-rw-r--r--fs/fs.c5
4 files changed, 21 insertions, 5 deletions
diff --git a/fs/ext4/ext4_journal.c b/fs/ext4/ext4_journal.c
index 02c4ac2cb93..868a2c1804a 100644
--- a/fs/ext4/ext4_journal.c
+++ b/fs/ext4/ext4_journal.c
@@ -131,6 +131,13 @@ int ext4fs_log_gdt(char *gd_table)
struct ext_filesystem *fs = get_fs();
short i;
long int var = fs->gdtable_blkno;
+
+ /* Make sure there is enough journal entries */
+ if (fs->no_blk_pergdt > MAX_JOURNAL_ENTRIES) {
+ log_err("*** Not enough journal entries allocated\n");
+ return -ENOMEM;
+ }
+
for (i = 0; i < fs->no_blk_pergdt; i++) {
journal_ptr[gindex]->buf = zalloc(fs->blksz);
if (!journal_ptr[gindex]->buf)
diff --git a/fs/ext4/ext4fs.c b/fs/ext4/ext4fs.c
index 7fb4c1b755b..3c79a889bc2 100644
--- a/fs/ext4/ext4fs.c
+++ b/fs/ext4/ext4fs.c
@@ -27,6 +27,7 @@
#include <ext4fs.h>
#include <malloc.h>
#include <part.h>
+#include <rtc.h>
#include <u-boot/uuid.h>
#include "ext4_common.h"
@@ -101,17 +102,21 @@ int ext4fs_read_file(struct ext2fs_node *node, loff_t pos,
blockcnt = lldiv(((len + pos) + blocksize - 1), blocksize);
for (i = lldiv(pos, blocksize); i < blockcnt; i++) {
- long int blknr;
+ lbaint_t blknr;
+ long blknr_and_status;
int blockoff = pos - (blocksize * i);
int blockend = blocksize;
int skipfirst = 0;
- blknr = read_allocated_block(&node->inode, i, &cache);
- if (blknr < 0) {
+ blknr_and_status = read_allocated_block(&node->inode, i, &cache);
+ if (blknr_and_status < 0) {
ext_cache_fini(&cache);
return -1;
}
- blknr = blknr << log2_fs_blocksize;
+ /* Block number could becomes very large when CONFIG_SYS_64BIT_LBA is enabled
+ * and wrap around at max long int
+ */
+ blknr = (lbaint_t)blknr_and_status << log2_fs_blocksize;
/* Last block. */
if (i == blockcnt - 1) {
diff --git a/fs/fat/fat.c b/fs/fat/fat.c
index e2570e81676..89f2acbba1e 100644
--- a/fs/fat/fat.c
+++ b/fs/fat/fat.c
@@ -21,6 +21,7 @@
#include <part.h>
#include <malloc.h>
#include <memalign.h>
+#include <rtc.h>
#include <asm/cache.h>
#include <linux/compiler.h>
#include <linux/ctype.h>
diff --git a/fs/fs.c b/fs/fs.c
index 1f36872fb9a..2650328b358 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -580,6 +580,7 @@ static int fs_read_lmb_check(const char *filename, ulong addr, loff_t offset,
int ret;
loff_t size;
loff_t read_len;
+ phys_addr_t read_addr;
/* get the actual size of the file */
ret = info->size(filename, &size);
@@ -597,7 +598,9 @@ static int fs_read_lmb_check(const char *filename, ulong addr, loff_t offset,
lmb_dump_all();
- if (!lmb_alloc_addr(addr, read_len, LMB_NONE))
+ read_addr = (phys_addr_t)addr;
+ if (!lmb_alloc_mem(LMB_MEM_ALLOC_ADDR, 0, &read_addr, read_len,
+ LMB_NONE))
return 0;
log_err("** Reading file would overwrite reserved memory **\n");