Print this page
7713 fabric-xlate fmd(1m) module isn't 64-bit safe

@@ -19,18 +19,21 @@
  * CDDL HEADER END
  */
 
 /*
  * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2016 Jason King
  */
+
 #include <strings.h>
 #include <fm/topo_hc.h>
 #include <sys/fm/util.h>
 #include <libxml/xpath.h>
 #include <libxml/parser.h>
 #include <libxml/xpathInternals.h>
 #include <libxml/tree.h>
+#include <sys/debug.h>
 
 #include "fabric-xlate.h"
 
 #define HAS_PROP(node, name) xmlHasProp(node, (const xmlChar *)name)
 #define GET_PROP(node, name) ((char *)xmlGetProp(node, (const xmlChar *)name))

@@ -182,18 +185,21 @@
 void
 fab_send_erpt(fmd_hdl_t *hdl, fab_data_t *data, fab_err_tbl_t *tbl)
 {
         fab_erpt_tbl_t  *erpt_tbl, *entry;
         nvlist_t        *erpt;
+        uintptr_t       addr;
         uint32_t        reg;
 
         erpt_tbl = tbl->erpt_tbl;
+        addr = (uintptr_t)data + tbl->reg_offset;
+
         if (tbl->reg_size == 16) {
-                reg = (uint32_t)*((uint16_t *)
-                    ((uint32_t)data + tbl->reg_offset));
+                reg = (uint32_t)*((uint16_t *)addr);
         } else {
-                reg = *((uint32_t *)((uint32_t)data + tbl->reg_offset));
+                ASSERT3U(tbl->reg_size, ==, 32);
+                reg = *((uint32_t *)addr);
         }
 
         for (entry = erpt_tbl; entry->err_class; entry++) {
                 if (!(reg & entry->reg_bit))
                         continue;