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

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/fm/modules/common/fabric-xlate/fx_subr.c
          +++ new/usr/src/cmd/fm/modules/common/fabric-xlate/fx_subr.c
↓ open down ↓ 13 lines elided ↑ open up ↑
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
  23   23   * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
       24 + * Copyright 2016 Jason King
  24   25   */
       26 +
  25   27  #include <strings.h>
  26   28  #include <fm/topo_hc.h>
  27   29  #include <sys/fm/util.h>
  28   30  #include <libxml/xpath.h>
  29   31  #include <libxml/parser.h>
  30   32  #include <libxml/xpathInternals.h>
  31   33  #include <libxml/tree.h>
       34 +#include <sys/debug.h>
  32   35  
  33   36  #include "fabric-xlate.h"
  34   37  
  35   38  #define HAS_PROP(node, name) xmlHasProp(node, (const xmlChar *)name)
  36   39  #define GET_PROP(node, name) ((char *)xmlGetProp(node, (const xmlChar *)name))
  37   40  #define FREE_PROP(prop) xmlFree((xmlChar *)prop)
  38   41  
  39   42  extern xmlXPathContextPtr fab_xpathCtx;
  40   43  
  41   44  /* ARGSUSED */
↓ open down ↓ 135 lines elided ↑ open up ↑
 177  180          if (fmri)
 178  181                  xmlFree(fmri);
 179  182          fmd_hdl_debug(hdl, "Failed to send Target PCI ereport\n");
 180  183  }
 181  184  
 182  185  void
 183  186  fab_send_erpt(fmd_hdl_t *hdl, fab_data_t *data, fab_err_tbl_t *tbl)
 184  187  {
 185  188          fab_erpt_tbl_t  *erpt_tbl, *entry;
 186  189          nvlist_t        *erpt;
      190 +        uintptr_t       addr;
 187  191          uint32_t        reg;
 188  192  
 189  193          erpt_tbl = tbl->erpt_tbl;
      194 +        addr = (uintptr_t)data + tbl->reg_offset;
      195 +
 190  196          if (tbl->reg_size == 16) {
 191      -                reg = (uint32_t)*((uint16_t *)
 192      -                    ((uint32_t)data + tbl->reg_offset));
      197 +                reg = (uint32_t)*((uint16_t *)addr);
 193  198          } else {
 194      -                reg = *((uint32_t *)((uint32_t)data + tbl->reg_offset));
      199 +                ASSERT3U(tbl->reg_size, ==, 32);
      200 +                reg = *((uint32_t *)addr);
 195  201          }
 196  202  
 197  203          for (entry = erpt_tbl; entry->err_class; entry++) {
 198  204                  if (!(reg & entry->reg_bit))
 199  205                          continue;
 200  206  
 201  207                  if (nvlist_alloc(&erpt, NV_UNIQUE_NAME, 0) != 0)
 202  208                          goto done;
 203  209                  if (tbl->fab_prep(hdl, data, erpt, entry) != 0) {
 204  210                          fmd_hdl_debug(hdl, "Prepping ereport failed: "
↓ open down ↓ 757 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX