mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Franck Jullien <franck.jullien@gmail.com>
To: barebox@lists.infradead.org
Subject: [PATCH 1/2] common/paritions.c: force little endian reads
Date: Thu, 11 Oct 2012 22:28:10 +0200	[thread overview]
Message-ID: <1349987291-11714-1-git-send-email-franck.jullien@gmail.com> (raw)

When reading values from a DOS disk, we need to force a little endian
reading.

Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
---
 common/partitions.c |    8 ++++----
 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;
-- 
1.7.1


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

             reply	other threads:[~2012-10-11 20:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-11 20:28 Franck Jullien [this message]
2012-10-11 20:28 ` [PATCH 2/2] common/partitions.c: make use of is_fat_or_mbr Franck Jullien
2012-10-11 20:44   ` Franck Jullien
2012-10-12  8:07 ` [PATCH 1/2] common/paritions.c: force little endian reads Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1349987291-11714-1-git-send-email-franck.jullien@gmail.com \
    --to=franck.jullien@gmail.com \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox