[PATCH 7/7] ext4: Use correct descriptor size when reading the block group descriptor

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is an adoption of the U-Boot commit

| commit f798b1dda1c5de818b806189e523d1b75db7e72d
| Author: Stefan Brüns <stefan.bruens@xxxxxxxxxxxxxx>
| Date:   Sat Sep 17 02:10:09 2016 +0200
|
|     ext4: Use correct descriptor size when reading the block group descriptor
|
|     The correct descriptor size must be used when calculating offsets, and
|     also to read the correct amount of data.
|
|     Signed-off-by: Stefan Brüns <stefan.bruens@xxxxxxxxxxxxxx>

Signed-off-by: Antony Pavlov <antonynpavlov@xxxxxxxxx>
---
 fs/ext4/ext4_common.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/fs/ext4/ext4_common.c b/fs/ext4/ext4_common.c
index f35eebc21..55e837b4b 100644
--- a/fs/ext4/ext4_common.c
+++ b/fs/ext4/ext4_common.c
@@ -83,19 +83,19 @@ static int ext4fs_blockgroup(struct ext2_data *data, int group,
 	long int blkno;
 	unsigned int blkoff, desc_per_blk;
 	struct ext_filesystem *fs = data->fs;
+	int desc_size = fs->gdsize;
 
-	desc_per_blk = EXT2_BLOCK_SIZE(data) / sizeof(struct ext2_block_group);
+	desc_per_blk = EXT2_BLOCK_SIZE(data) / desc_size;
 
 	blkno = le32_to_cpu(data->sblock.first_data_block) + 1 +
 			group / desc_per_blk;
-	blkoff = (group % desc_per_blk) * sizeof(struct ext2_block_group);
+	blkoff = (group % desc_per_blk) * desc_size;
 
 	dev_dbg(fs->dev, "read %d group descriptor (blkno %ld blkoff %u)\n",
 	      group, blkno, blkoff);
 
 	return ext4fs_devread(fs, blkno << LOG2_EXT2_BLOCK_SIZE(data),
-			      blkoff, sizeof(struct ext2_block_group),
-			      (char *)blkgrp);
+				blkoff, desc_size, (char *)blkgrp);
 }
 
 int ext4fs_read_inode(struct ext2_data *data, int ino, struct ext2_inode *inode)
-- 
2.11.0


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox




[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux