Print this page
10135 picl plugins need smatch fixes

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/picl/plugins/common/devtree/picldevtree.c
          +++ new/usr/src/cmd/picl/plugins/common/devtree/picldevtree.c
↓ open down ↓ 16 lines elided ↑ open up ↑
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*
  22   22   * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  23   23   * Use is subject to license terms.
  24   24   */
  25   25  
  26   26  /*
       27 + * Copyright (c) 2018, Joyent, Inc.
       28 + */
       29 +
       30 +/*
  27   31   * PICL plug-in that creates device tree nodes for all platforms
  28   32   */
  29   33  
  30   34  #include <stdio.h>
  31   35  #include <string.h>
  32   36  #include <ctype.h>
  33   37  #include <limits.h>
  34   38  #include <stdlib.h>
  35   39  #include <assert.h>
  36   40  #include <alloca.h>
↓ open down ↓ 1726 lines elided ↑ open up ↑
1763 1767          return (DI_WALK_CONTINUE);
1764 1768  }
1765 1769  
1766 1770  /*
1767 1771   * Walk the snapshot and check the OBP properties of each node.
1768 1772   */
1769 1773  static int
1770 1774  is_snapshot_stale(di_node_t root)
1771 1775  {
1772 1776          snapshot_stale = 0;
1773      -        di_walk_node(root, DI_WALK_CLDFIRST, NULL, check_stale_node);
     1777 +        (void) di_walk_node(root, DI_WALK_CLDFIRST, NULL, check_stale_node);
1774 1778          return (snapshot_stale);
1775 1779  }
1776 1780  
1777 1781  /*
1778 1782   * This function processes the data from libdevinfo and creates nodes
1779 1783   * in the PICL tree.
1780 1784   */
1781 1785  static int
1782 1786  libdevinfo_init(picl_nodehdl_t rooth)
1783 1787  {
↓ open down ↓ 755 lines elided ↑ open up ↑
2539 2543                  (void) close(d);
2540 2544                  return (0);
2541 2545          }
2542 2546          *exportlist = malloc(listsize);
2543 2547          if (*exportlist == NULL) {
2544 2548                  free(opp);
2545 2549                  (void) close(d);
2546 2550                  return (0);
2547 2551          }
2548 2552          (void) memcpy(*exportlist, opp->oprom_array, opp->oprom_size);
2549      -        free(opp);
2550 2553          *exportlistlen = opp->oprom_size;
     2554 +        free(opp);
2551 2555          (void) close(d);
2552 2556          return (1);
2553 2557  }
2554 2558  
2555 2559  /*
2556 2560   * Parses properties string, fills in triplet structure with first
2557 2561   * type, name, val triplet and returns pointer to next property.
2558 2562   * Returns NULL if no valid triplet found
2559 2563   * CAUTION: drops \0 characters over separator characters: if you
2560 2564   * want to parse the string twice, you'll have to take a copy.
↓ open down ↓ 1230 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX