From d69518220005539b0e20759bcc0b47d83e89fe79 Mon Sep 17 00:00:00 2001 From: Daniel Verkamp Date: Fri, 21 Jul 2017 12:44:07 -0700 Subject: [PATCH] bdev/gpt: fix MBR start_lba endian conversion The message printed when start_lba doesn't match the expected value would print byte-swapped values on big-endian architectures. On little-endian architectures, the problem would not be noticeable, since the conversion doesn't do anything. Change-Id: I9e8d4485b5710f4333d04bb006bc204416c689cd Signed-off-by: Daniel Verkamp Reviewed-on: https://review.gerrithub.io/370730 Tested-by: SPDK Automated Test System Reviewed-by: Ben Walker --- lib/bdev/gpt/gpt.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/bdev/gpt/gpt.c b/lib/bdev/gpt/gpt.c index 9cf61b15a..c7b05fe43 100644 --- a/lib/bdev/gpt/gpt.c +++ b/lib/bdev/gpt/gpt.c @@ -208,10 +208,10 @@ spdk_gpt_check_mbr(struct spdk_gpt *gpt) return -1; } - to_le32(&expected_start_lba, GPT_PRIMARY_PARTITION_TABLE_LBA); - if (mbr->partitions[0].start_lba != expected_start_lba) { + expected_start_lba = GPT_PRIMARY_PARTITION_TABLE_LBA; + if (from_le32(&mbr->partitions[0].start_lba) != expected_start_lba) { SPDK_TRACELOG(SPDK_TRACE_GPT_PARSE, "start lba mismatch, provided=%u, expected=%u\n", - mbr->partitions[0].start_lba, expected_start_lba); + from_le32(&mbr->partitions[0].start_lba), expected_start_lba); return -1; }