aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/mpsutil/mps_flash.c
diff options
context:
space:
mode:
authorAlfredo Dal'Ava Junior <alfredo@FreeBSD.org>2021-04-17 01:01:38 +0000
committerAlfredo Dal'Ava Junior <alfredo@FreeBSD.org>2021-04-20 22:19:47 +0000
commitfc9780fd41e7b29db04e9cb843cb5034b88ae662 (patch)
treec1cfdc8cee833ef04f877edf3977427f179e2b6d /usr.sbin/mpsutil/mps_flash.c
parent561d34d70596b455c6a513431f8ad007076f90c5 (diff)
downloadsrc-fc9780fd41e7b29db04e9cb843cb5034b88ae662.tar.gz
src-fc9780fd41e7b29db04e9cb843cb5034b88ae662.zip
Diffstat (limited to 'usr.sbin/mpsutil/mps_flash.c')
-rw-r--r--usr.sbin/mpsutil/mps_flash.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/usr.sbin/mpsutil/mps_flash.c b/usr.sbin/mpsutil/mps_flash.c
index 22beaae79bb0..a0cc4a877b7d 100644
--- a/usr.sbin/mpsutil/mps_flash.c
+++ b/usr.sbin/mpsutil/mps_flash.c
@@ -29,6 +29,7 @@ __RCSID("$FreeBSD$");
#include <sys/stat.h>
#include <sys/param.h>
#include <sys/mman.h>
+#include <sys/endian.h>
#include <errno.h>
#include <err.h>
@@ -203,21 +204,21 @@ flash_update(int argc, char **argv)
}
} else {
fwheader = (MPI2_FW_IMAGE_HEADER *)mem;
- if (fwheader->VendorID != MPI2_MFGPAGE_VENDORID_LSI) {
+ if (le16toh(fwheader->VendorID) != MPI2_MFGPAGE_VENDORID_LSI) {
warnx("Invalid firmware:");
warnx(" Expected Vendor ID: %04x",
MPI2_MFGPAGE_VENDORID_LSI);
- warnx(" Image Vendor ID: %04x", fwheader->VendorID);
+ warnx(" Image Vendor ID: %04x", le16toh(fwheader->VendorID));
munmap(mem, st.st_size);
close(fd);
free(facts);
return (1);
}
- if (fwheader->ProductID != facts->ProductID) {
+ if (le16toh(fwheader->ProductID) != facts->ProductID) {
warnx("Invalid image:");
warnx(" Expected Product ID: %04x", facts->ProductID);
- warnx(" Image Product ID: %04x", fwheader->ProductID);
+ warnx(" Image Product ID: %04x", le16toh(fwheader->ProductID));
munmap(mem, st.st_size);
close(fd);
free(facts);