Project

General

Profile

Bug #11158

fm: NULL pointer errors

Added by Toomas Soome about 1 year ago. Updated about 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
lib - userland libraries
Start date:
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:

Description

NULL pointer errors:

    x86pi_hostbridge.c: In function 'pciex_process':
    x86pi_hostbridge.c:109:10: error: return makes integer from pointer without a cast [-Werror=int-conversion]
       return (NULL);
              ^

    chip_intel.c: In function 'mc_nb_create':
    chip_intel.c:432:9: error: return makes integer from pointer without a cast [-Werror=int-conversion]
      return (NULL);
             ^
    chip_intel.c: In function 'mc_node_create':
    chip_intel.c:454:10: error: return makes integer from pointer without a cast [-Werror=int-conversion]
       return (NULL);
              ^
    chip_intel.c:463:10: error: return makes integer from pointer without a cast [-Werror=int-conversion]
       return (NULL);
              ^
    chip_intel.c:467:10: error: return makes integer from pointer without a cast [-Werror=int-conversion]
       return (NULL);
              ^

    In file included from /code/illumos-gate/proto/root_i386/usr/include/iso/time_iso.h:49:0,
                     from /code/illumos-gate/proto/root_i386/usr/include/time.h:40,
                     from /code/illumos-gate/proto/root_i386/usr/include/sys/time.h:462,
                     from /code/illumos-gate/proto/root_i386/usr/include/sys/select.h:53,
                     from /code/illumos-gate/proto/root_i386/usr/include/sys/types.h:640,
                     from /code/illumos-gate/proto/root_i386/usr/include/fcntl.h:39,
                     from ../../common/smbios/smbios_enum.c:17:
    ../../common/smbios/smbios_enum.c: In function 'smbios_make_slot':
    /code/illumos-gate/proto/root_i386/usr/include/sys/null.h:28:14: error: passing argument 3 of 'topo_node_fru_set' makes integer from pointer without a cast [-Werror=int-conversion]
     #define NULL ((void *)0)
                  ^
    ../../common/smbios/smbios_enum.c:148:40: note: in expansion of macro 'NULL'
          topo_node_fru_set(slotnode, fmri, NULL, &err) != 0) {
                                            ^~~~
    In file included from ../../common/smbios/smbios_enum.c:19:0:
    /code/illumos-gate/proto/root_i386/usr/include/fm/topo_mod.h:247:12: note: expected 'int' but argument is of type 'void *'
     extern int topo_node_fru_set(tnode_t *node, nvlist_t *, int, int *);
                ^~~~~~~~~~~~~~~~~
    In file included from /code/illumos-gate/proto/root_i386/usr/include/iso/time_iso.h:49:0,
                     from /code/illumos-gate/proto/root_i386/usr/include/time.h:40,
                     from /code/illumos-gate/proto/root_i386/usr/include/sys/time.h:462,
                     from /code/illumos-gate/proto/root_i386/usr/include/sys/select.h:53,
                     from /code/illumos-gate/proto/root_i386/usr/include/sys/types.h:640,
                     from /code/illumos-gate/proto/root_i386/usr/include/fcntl.h:39,
                     from ../../common/smbios/smbios_enum.c:17:
    ../../common/smbios/smbios_enum.c: In function 'smbios_make_dimm':
    /code/illumos-gate/proto/root_i386/usr/include/sys/null.h:28:14: error: passing argument 3 of 'topo_node_fru_set' makes integer from pointer without a cast [-Werror=int-conversion]
     #define NULL ((void *)0)
                  ^
    ../../common/smbios/smbios_enum.c:249:40: note: in expansion of macro 'NULL'
      if (topo_node_fru_set(dimmnode, fmri, NULL, &err) != 0) {
                                            ^~~~
    In file included from ../../common/smbios/smbios_enum.c:19:0:
    /code/illumos-gate/proto/root_i386/usr/include/fm/topo_mod.h:247:12: note: expected 'int' but argument is of type 'void *'
     extern int topo_node_fru_set(tnode_t *node, nvlist_t *, int, int *);
                ^~~~~~~~~~~~~~~~~
    In file included from /code/illumos-gate/proto/root_i386/usr/include/iso/time_iso.h:49:0,
                     from /code/illumos-gate/proto/root_i386/usr/include/time.h:40,
                     from /code/illumos-gate/proto/root_i386/usr/include/sys/time.h:462,
                     from /code/illumos-gate/proto/root_i386/usr/include/sys/select.h:53,
                     from /code/illumos-gate/proto/root_i386/usr/include/sys/types.h:640,
                     from /code/illumos-gate/proto/root_i386/usr/include/fcntl.h:39,
                     from ../../common/smbios/smbios_enum.c:17:
    ../../common/smbios/smbios_enum.c: In function 'smbios_enum_motherboard':
    /code/illumos-gate/proto/root_i386/usr/include/sys/null.h:28:14: error: passing argument 3 of 'topo_node_fru_set' makes integer from pointer without a cast [-Werror=int-conversion]
     #define NULL ((void *)0)
                  ^
    ../../common/smbios/smbios_enum.c:474:38: note: in expansion of macro 'NULL'
      if (topo_node_fru_set(mbnode, fmri, NULL, &err) != 0) {
                                          ^~~~
    In file included from ../../common/smbios/smbios_enum.c:19:0:
    /code/illumos-gate/proto/root_i386/usr/include/fm/topo_mod.h:247:12: note: expected 'int' but argument is of type 'void *'
     extern int topo_node_fru_set(tnode_t *node, nvlist_t *, int, int *);
                ^~~~~~~~~~~~~~~~~

    ../../common/ses/ses.c: In function 'ses_contract_thread':
    ../../common/ses/ses.c:573:19: error: assignment makes integer from pointer without a cast [-Werror=int-conversion]
         stp->set_ctid = NULL;
                       ^
    ../../common/ses/ses.c: In function 'ses_create_contract':
    ../../common/ses/ses.c:695:16: error: assignment makes integer from pointer without a cast [-Werror=int-conversion]
      stp->set_ctid = NULL;
                    ^
    ../../common/ses/ses.c: In function 'ses_target_free':
    ../../common/ses/ses.c:742:18: error: assignment makes integer from pointer without a cast [-Werror=int-conversion]
        stp->set_ctid = NULL;
                      ^
    ../../common/ses/ses.c: In function 'ses_node_lock':
    ../../common/ses/ses.c:932:20: error: comparison between pointer and integer [-Werror]
       if (tp->set_ctid != NULL) {
                        ^~
    In file included from /code/illumos-gate/proto/root_i386/usr/include/iso/time_iso.h:49:0,
                     from /code/illumos-gate/proto/root_i386/usr/include/time.h:40,
                     from /code/illumos-gate/proto/root_i386/usr/include/sys/time.h:462,
                     from /code/illumos-gate/proto/root_i386/usr/include/sys/select.h:53,
                     from /code/illumos-gate/proto/root_i386/usr/include/sys/types.h:640,
                     from /code/illumos-gate/proto/root_i386/usr/include/alloca.h:32,
                     from ../../common/ses/ses.c:29:
    ../../common/ses/ses.c: In function 'ses_create_esc_sasspecific':
    /code/illumos-gate/proto/root_i386/usr/include/sys/null.h:28:14: error: initialization makes integer from pointer without a cast [-Werror=int-conversion]
     #define NULL ((void *)0)
                  ^
    ../../common/ses/ses.c:1886:45: note: in expansion of macro 'NULL'
      sas_connector_phy_data_t connectors[64] = {NULL};
                                                 ^~~~
    /code/illumos-gate/proto/root_i386/usr/include/sys/null.h:28:14: note: (near initialization for 'connectors[0].scpd_index')
     #define NULL ((void *)0)
                  ^
    ../../common/ses/ses.c:1886:45: note: in expansion of macro 'NULL'
      sas_connector_phy_data_t connectors[64] = {NULL};
                                                 ^~~~
    /code/illumos-gate/proto/root_i386/usr/include/sys/null.h:28:14: error: initialization makes integer from pointer without a cast [-Werror=int-conversion]
     #define NULL ((void *)0)
                  ^
    ../../common/ses/ses.c:1892:27: note: in expansion of macro 'NULL'
      int64_t cidxlist[256] = {NULL};
                               ^~~~
    /code/illumos-gate/proto/root_i386/usr/include/sys/null.h:28:14: note: (near initialization for 'cidxlist[0]')
     #define NULL ((void *)0)
                  ^
    ../../common/ses/ses.c:1892:27: note: in expansion of macro 'NULL'
      int64_t cidxlist[256] = {NULL};
                               ^~~~

    In file included from /code/illumos-gate/proto/root_i386/usr/include/iso/time_iso.h:49:0,
                     from /code/illumos-gate/proto/root_i386/usr/include/time.h:40,
                     from /code/illumos-gate/proto/root_i386/usr/include/sys/time.h:462,
                     from /code/illumos-gate/proto/root_i386/usr/include/sys/select.h:53,
                     from /code/illumos-gate/proto/root_i386/usr/include/sys/types.h:640,
                     from /code/illumos-gate/proto/root_i386/usr/include/strings.h:32,
                     from ../../common/disk/disk_common.c:39:
    ../../common/disk/disk_common.c: In function 'disk_set_props':
    /code/illumos-gate/proto/root_i386/usr/include/sys/null.h:28:14: error: initialization makes integer from pointer without a cast [-Werror=int-conversion]
     #define NULL ((void *)0)
                  ^
    ../../common/disk/disk_common.c:146:32: note: in expansion of macro 'NULL'
      dm_descriptor_t drive_descr = NULL;
                                    ^~~~
    ../../common/disk/disk_common.c:288:31: error: comparison between pointer and integer [-Werror]
          dnode->ddn_devid, &err)) == NULL ||
                                   ^~
    ../../common/disk/disk_common.c:306:18: error: comparison between pointer and integer [-Werror]
      if (drive_descr != NULL)
                      ^~
    In file included from /code/illumos-gate/proto/root_i386/usr/include/iso/time_iso.h:49:0,
                     from /code/illumos-gate/proto/root_i386/usr/include/time.h:40,
                     from /code/illumos-gate/proto/root_i386/usr/include/sys/time.h:462,
                     from /code/illumos-gate/proto/root_i386/usr/include/sys/select.h:53,
                     from /code/illumos-gate/proto/root_i386/usr/include/sys/types.h:640,
                     from /code/illumos-gate/proto/root_i386/usr/include/strings.h:32,
                     from ../../common/disk/disk_common.c:39:
    ../../common/disk/disk_common.c: In function 'disk_temp_reading':
    /code/illumos-gate/proto/root_i386/usr/include/sys/null.h:28:14: error: initialization makes integer from pointer without a cast [-Werror=int-conversion]
     #define NULL ((void *)0)
                  ^
    ../../common/disk/disk_common.c:354:32: note: in expansion of macro 'NULL'
      dm_descriptor_t drive_descr = NULL;
                                    ^~~~
    ../../common/disk/disk_common.c:369:13: error: comparison between pointer and integer [-Werror]
          &err)) == NULL) {
                 ^~
    cc1: all warnings being treated as errors

History

#1

Updated by Toomas Soome about 1 year ago

the issue in x86pi_hostbridge.c is actually bug - we should return -1 on error.

#2

Updated by Electric Monk about 1 year ago

  • Status changed from In Progress to Closed
  • % Done changed from 90 to 100

git commit 5cc5d5cece01c2151c34ac6d97b0bd369aded9ed

commit  5cc5d5cece01c2151c34ac6d97b0bd369aded9ed
Author: Toomas Soome <tsoome@me.com>
Date:   2019-07-03T07:40:07.000Z

    11158 fm: NULL pointer errors
    Reviewed by: John Levon <john.levon@joyent.com>
    Approved by: Richard Lowe <richlowe@richlowe.net>

Also available in: Atom PDF