Skip to content
Snippets Groups Projects
Commit c28cbfa1 authored by Stephen Warren's avatar Stephen Warren Committed by Tom Rini
Browse files

ext4: assign get_fs()->dev_desc before using it


Commit 50ce4c07 "fs/ext4: Support device block sizes != 512 bytes"
modified ext4fs_set_blk_dev() to calculate total_sect based on
get_fs()->dev_desc->log2blksz rather than SECTOR_SIZE. However, this
value wasn't yet assigned. Move the assignment earlier so the code
doesn't crash or hang.

Cc: Egbert Eich <eich@suse.com>
Tested-by: default avatarTom Rini <trini@ti.com>
Signed-off-by: default avatarStephen Warren <swarren@nvidia.com>
parent 24c185cf
No related branches found
No related tags found
No related merge requests found
...@@ -51,11 +51,11 @@ void ext4fs_set_blk_dev(block_dev_desc_t *rbdd, disk_partition_t *info) ...@@ -51,11 +51,11 @@ void ext4fs_set_blk_dev(block_dev_desc_t *rbdd, disk_partition_t *info)
{ {
assert(rbdd->blksz == (1 << rbdd->log2blksz)); assert(rbdd->blksz == (1 << rbdd->log2blksz));
ext4fs_block_dev_desc = rbdd; ext4fs_block_dev_desc = rbdd;
get_fs()->dev_desc = rbdd;
part_info = info; part_info = info;
part_offset = info->start; part_offset = info->start;
get_fs()->total_sect = (info->size * info->blksz) >> get_fs()->total_sect = (info->size * info->blksz) >>
get_fs()->dev_desc->log2blksz; get_fs()->dev_desc->log2blksz;
get_fs()->dev_desc = rbdd;
} }
int ext4fs_devread(int sector, int byte_offset, int byte_len, char *buf) int ext4fs_devread(int sector, int byte_offset, int byte_len, char *buf)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment