summaryrefslogtreecommitdiffstats
path: root/common/partitions.c
diff options
context:
space:
mode:
authorFranck Jullien <franck.jullien@gmail.com>2012-10-11 22:28:10 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2012-10-12 10:07:23 +0200
commitcbe3457dd82759f2c8ed02b34ba742a79353857d (patch)
tree93dd6954039e48aabb98e6f17f1e628153b7f1a9 /common/partitions.c
parent0502e3db73704feaf9cc2308f2caa8d53f393051 (diff)
downloadbarebox-cbe3457dd82759f2c8ed02b34ba742a79353857d.tar.gz
common/paritions.c: force little endian reads
When reading values from a DOS disk, we need to force a little endian reading. Signed-off-by: Franck Jullien <franck.jullien@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/partitions.c')
-rw-r--r--common/partitions.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/common/partitions.c b/common/partitions.c
index cee0a65..0e42937 100644
--- a/common/partitions.c
+++ b/common/partitions.c
@@ -52,8 +52,8 @@ static int disk_guess_size(struct device_d *dev, struct partition_entry *table)
for (i = 0; i < 4; i++) {
if (table[i].partition_start != 0) {
- size += get_unaligned(&table[i].partition_start) - size;
- size += get_unaligned(&table[i].partition_size);
+ size += get_unaligned_le32(&table[i].partition_start) - size;
+ size += get_unaligned_le32(&table[i].partition_size);
}
}
@@ -97,8 +97,8 @@ static void __maybe_unused try_dos_partition(struct block_device *blk,
blk->num_blocks = disk_guess_size(blk->dev, table);
for (i = 0; i < 4; i++) {
- pentry.first_sec = get_unaligned(&table[i].partition_start);
- pentry.size = get_unaligned(&table[i].partition_size);
+ pentry.first_sec = get_unaligned_le32(&table[i].partition_start);
+ pentry.size = get_unaligned_le32(&table[i].partition_size);
if (pentry.first_sec != 0) {
pd->parts[pd->used_entries].first_sec = pentry.first_sec;