diff options
Diffstat (limited to 'fs/ext4')
-rw-r--r-- | fs/ext4/ext4_common.c | 10 | ||||
-rw-r--r-- | fs/ext4/ext4_write.c | 6 | ||||
-rw-r--r-- | fs/ext4/ext4fs.c | 2 |
3 files changed, 10 insertions, 8 deletions
diff --git a/fs/ext4/ext4_common.c b/fs/ext4/ext4_common.c index cc150cf824f..8e6531fa3f0 100644 --- a/fs/ext4/ext4_common.c +++ b/fs/ext4/ext4_common.c @@ -198,16 +198,18 @@ void put_ext4(uint64_t off, const void *buf, uint32_t size) uint64_t remainder; unsigned char *temp_ptr = NULL; struct ext_filesystem *fs = get_fs(); - int log2blksz = fs->dev_desc->log2blksz; + int log2blksz; + + if (!fs->dev_desc) + return; + ALLOC_CACHE_ALIGN_BUFFER(unsigned char, sec_buf, fs->dev_desc->blksz); + log2blksz = fs->dev_desc->log2blksz; startblock = off >> log2blksz; startblock += part_offset; remainder = off & (uint64_t)(fs->dev_desc->blksz - 1); - if (fs->dev_desc == NULL) - return; - if ((startblock + (size >> log2blksz)) > (part_offset + fs->total_sect)) { printf("part_offset is " LBAFU "\n", part_offset); diff --git a/fs/ext4/ext4_write.c b/fs/ext4/ext4_write.c index d109ed6e90d..dd8ed40f888 100644 --- a/fs/ext4/ext4_write.c +++ b/fs/ext4/ext4_write.c @@ -877,19 +877,19 @@ int ext4fs_write(const char *fname, const char *buffer, if (ext4fs_init() != 0) { printf("error in File System init\n"); - return -1; + goto fail; } missing_feat = le32_to_cpu(fs->sb->feature_incompat) & ~EXT4_FEATURE_INCOMPAT_SUPP; if (missing_feat) { log_err("Unsupported features found %08x, not writing.\n", missing_feat); - return -1; + goto fail; } missing_feat = le32_to_cpu(fs->sb->feature_ro_compat) & ~EXT4_FEATURE_RO_COMPAT_SUPP; if (missing_feat) { log_err("Unsupported RO compat features found %08x, not writing.\n", missing_feat); - return -1; + goto fail; } inodes_per_block = fs->blksz / fs->inodesz; diff --git a/fs/ext4/ext4fs.c b/fs/ext4/ext4fs.c index 9be99594f50..3c79a889bc2 100644 --- a/fs/ext4/ext4fs.c +++ b/fs/ext4/ext4fs.c @@ -277,7 +277,7 @@ int ext4fs_readdir(struct fs_dir_stream *fs_dirs, struct fs_dirent **dentp) sizeof(struct ext2_dirent), (char *)&dirent, &actread); if (ret < 0) - return -ret; + return ret; if (!dirent.direntlen) return -EIO; |