[ofa-general] [PATCH] libibmad/fields.c: _set_field64 sets field in network rather than host order

Hal Rosenstock hrosenstock at xsigo.com
Thu Jun 5 11:14:38 PDT 2008


libibmad/fields.c: _set_field64 sets field in network rather than host
order

Fix issue introduced by commit 608cddb34fda942b37d0f2bb2e7889e22ac046f8

Signed-off-by: Hal Rosenstock <hal at xsigo.com>

diff --git a/libibmad/src/fields.c b/libibmad/src/fields.c
index c93a9d4..6942e85 100644
--- a/libibmad/src/fields.c
+++ b/libibmad/src/fields.c
@@ -366,7 +366,10 @@ ib_field_t ib_mad_f [] = {
 void
 _set_field64(void *buf, int base_offs, ib_field_t *f, uint64_t val)
 {
-	memcpy((char *)buf + base_offs + f->bitoffs / 8, &val, sizeof(uint64_t));
+	uint64_t nval;
+
+	nval = htonll(val);
+	memcpy((char *)buf + base_offs + f->bitoffs / 8, &nval, sizeof(uint64_t));
 }
 
 uint64_t





More information about the general mailing list