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 <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/370730
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Daniel Verkamp 2017-07-21 12:44:07 -07:00 committed by Ben Walker
parent e5f5d9803e
commit d695182200

View File

@ -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;
}