Project

General

Profile

Bug #11091

libc: NULL pointer errors

Added by Toomas Soome 5 months ago. Updated 4 months ago.

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

100%

Estimated time:
Difficulty:
Medium
Tags:

Description

NULL pointer errors:

    /code/illumos-gate/usr/src/tools/proto/root_i386-nd/opt/onbld/bin/i386/cw --prim
    ary gcc7,/usr/gcc/7/bin/gcc,gnu  -- -D_REENTRANT -Di386    -I../i386/inc -I/code
    /illumos-gate/usr/src/lib/libc/inc -DTEXT_DOMAIN=\"SUNW_OST_OSLIB\" -D_TS_ERRNO
     -I/code/illumos-gate/proto/root_i386/usr/include      -D_RETAIN_OLD_SYSCALLS -D
    PIC -D_REENTRANT -_smatch=off -g -xc99=%all -W0,-noglobal  -xdebugformat=stabs -
    O -S -fpic \
        ../i386/crt/_rtld.c -o ../i386/crt/_rtld.s
    + /usr/gcc/7/bin/gcc -fident -finline -fno-inline-functions -fno-builtin -fno-asm -fdiagnostics-show-option -nodefaultlibs -D__sun -D_REENTRANT -Di386 -I../i386/inc -I/code/illumos-gate/usr/src/lib/libc/inc -DTEXT_DOMAIN="SUNW_OST_OSLIB" -D_TS_ERRNO -I/code/illumos-gate/proto/root_i386/usr/include -D_RETAIN_OLD_SYSCALLS -DPIC -D_REENTRANT -gdwarf-2 -std=gnu99 -O -S -fpic ../i386/crt/_rtld.c -o ../i386/crt/_rtld.s
    ../i386/crt/_rtld.c: In function '__rtld':
    ../i386/crt/_rtld.c:102:21: warning: comparison between pointer and integer
      while (ebp->eb_tag != NULL) {
                         ^~
    /usr/bin/cat ../i386/crt/_rtboot.s ../i386/crt/_rtld.s > ../i386/crt/_rtbootld.s
    /usr/bin/rm -f ../i386/crt/_rtld.s

    ../port/gen/plock.c: In function 'plock':
    ../port/gen/plock.c:120:26: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
           PROC_TEXT|PRIVATE, (int)NULL);
                              ^
    ../port/gen/plock.c:147:26: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
           PROC_DATA|PRIVATE, (int)NULL);
                              ^
    ../port/gen/plock.c:163:49: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
            (caddr_t)MCL_CURRENT, PROC_DATA|PRIVATE, (int)NULL);
                                                     ^

    In file included from /code/illumos-gate/proto/root_i386/usr/include/iso/stdlib_iso.h:50:0,
                     from /code/illumos-gate/proto/root_i386/usr/include/stdlib.h:37,
                     from /code/illumos-gate/usr/src/lib/libc/inc/thr_uberdata.h:34,
                     from ../port/threads/thr.c:32:
    /code/illumos-gate/proto/root_i386/usr/include/sys/null.h:32:14: error: initialization makes integer from pointer without a cast [-Werror=int-conversion]
     #define NULL ((void *)0)
                  ^
    ../port/threads/thr.c:91:18: note: in expansion of macro 'NULL'
      { DEFAULTMUTEX, NULL, 0 }, /* link_lock */
                      ^~~~
    /code/illumos-gate/proto/root_i386/usr/include/sys/null.h:32:14: note: (near initialization for '__uberdata._link_lock.pad_pad[0]')
     #define NULL ((void *)0)
                  ^
    ../port/threads/thr.c:91:18: note: in expansion of macro 'NULL'
      { DEFAULTMUTEX, NULL, 0 }, /* link_lock */
                      ^~~~
    /code/illumos-gate/proto/root_i386/usr/include/sys/null.h:32:14: error: initialization makes integer from pointer without a cast [-Werror=int-conversion]
     #define NULL ((void *)0)
                  ^
    ../port/threads/thr.c:92:20: note: in expansion of macro 'NULL'
      { RECURSIVEMUTEX, NULL, 0 }, /* ld_lock */
                        ^~~~
    /code/illumos-gate/proto/root_i386/usr/include/sys/null.h:32:14: note: (near initialization for '__uberdata._ld_lock.pad_pad[0]')
     #define NULL ((void *)0)
                  ^
    ../port/threads/thr.c:92:20: note: in expansion of macro 'NULL'
      { RECURSIVEMUTEX, NULL, 0 }, /* ld_lock */
                        ^~~~
    /code/illumos-gate/proto/root_i386/usr/include/sys/null.h:32:14: error: initialization makes integer from pointer without a cast [-Werror=int-conversion]
     #define NULL ((void *)0)
                  ^
    ../port/threads/thr.c:93:20: note: in expansion of macro 'NULL'
      { RECURSIVEMUTEX, NULL, 0 }, /* fork_lock */
                        ^~~~
    /code/illumos-gate/proto/root_i386/usr/include/sys/null.h:32:14: note: (near initialization for '__uberdata._fork_lock.pad_pad[0]')
     #define NULL ((void *)0)
                  ^
    ../port/threads/thr.c:93:20: note: in expansion of macro 'NULL'
      { RECURSIVEMUTEX, NULL, 0 }, /* fork_lock */
                        ^~~~
    /code/illumos-gate/proto/root_i386/usr/include/sys/null.h:32:14: error: initialization makes integer from pointer without a cast [-Werror=int-conversion]
     #define NULL ((void *)0)
                  ^
    ../port/threads/thr.c:94:20: note: in expansion of macro 'NULL'
      { RECURSIVEMUTEX, NULL, 0 }, /* atfork_lock */
                        ^~~~
    /code/illumos-gate/proto/root_i386/usr/include/sys/null.h:32:14: note: (near initialization for '__uberdata._atfork_lock.pad_pad[0]')
     #define NULL ((void *)0)
                  ^
    ../port/threads/thr.c:94:20: note: in expansion of macro 'NULL'
      { RECURSIVEMUTEX, NULL, 0 }, /* atfork_lock */
                        ^~~~
    /code/illumos-gate/proto/root_i386/usr/include/sys/null.h:32:14: error: initialization makes integer from pointer without a cast [-Werror=int-conversion]
     #define NULL ((void *)0)
                  ^
    ../port/threads/thr.c:95:20: note: in expansion of macro 'NULL'
      { RECURSIVEMUTEX, NULL, 0 }, /* callout_lock */
                        ^~~~
    /code/illumos-gate/proto/root_i386/usr/include/sys/null.h:32:14: note: (near initialization for '__uberdata._callout_lock.pad_pad[0]')
     #define NULL ((void *)0)
                  ^
    ../port/threads/thr.c:95:20: note: in expansion of macro 'NULL'
      { RECURSIVEMUTEX, NULL, 0 }, /* callout_lock */
                        ^~~~
    /code/illumos-gate/proto/root_i386/usr/include/sys/null.h:32:14: error: initialization makes integer from pointer without a cast [-Werror=int-conversion]
     #define NULL ((void *)0)
                  ^
    ../port/threads/thr.c:96:18: note: in expansion of macro 'NULL'
      { DEFAULTMUTEX, NULL, 0 }, /* tdb_hash_lock */
                      ^~~~
    /code/illumos-gate/proto/root_i386/usr/include/sys/null.h:32:14: note: (near initialization for '__uberdata._tdb_hash_lock.pad_pad[0]')
     #define NULL ((void *)0)
                  ^
    ../port/threads/thr.c:96:18: note: in expansion of macro 'NULL'
      { DEFAULTMUTEX, NULL, 0 }, /* tdb_hash_lock */
                      ^~~~

    ../port/threads/tdb_agent.c: In function 'tdb_sync_obj_deregister':
    ../port/threads/tdb_agent.c:371:59: error: comparison between pointer and integer [-Werror]
          tdbp->tdb_sync_addr_hash[hash = tdb_addr_hash(addr)] == NULL)
                                                               ^~

    ../port/gen/ttyname.c: In function '_ttyname_common':
    ../port/gen/ttyname.c:288:42: error: comparison between pointer and integer [-Werror]
       if (strcmp(PTS, srch_dirs[dirno].name) == NULL) {
                                              ^~

    ../port/gen/catopen.c: In function 'process_nls_path':
    ../port/gen/catopen.c:129:12: error: assignment makes integer from pointer without a cast [-Werror=int-conversion]
          *s1++ = NULL;
                ^
    ../port/gen/catopen.c:132:12: error: assignment makes integer from pointer without a cast [-Werror=int-conversion]
          *s2++ = NULL;
                ^
    ../port/gen/catopen.c:209:5: error: assignment makes integer from pointer without a cast [-Werror=int-conversion]
      *t = NULL;
         ^
    ../port/gen/catopen.c: In function 'replace_nls_option':
    ../port/gen/catopen.c:272:5: error: assignment makes integer from pointer without a cast [-Werror=int-conversion]
      *t = NULL;
         ^

    ../port/gen/mkstemp.c: In function 'libc_mkstemps64':
    ../port/gen/mkstemp.c:70:24: error: comparison between pointer and integer [-Werror]
      if (as == NULL || *as == NULL)
                            ^~

    ../port/gen/getopt.c: In function 'getopt':
    ../port/gen/getopt.c:202:39: error: comparison between pointer and integer [-Werror]
       else if (strcmp(argv[optind], "--") == NULL) {
                                           ^~

    ../port/gen/_xftw.c: In function 'nocdstat':
    ../port/gen/_xftw.c:351:12: error: return makes integer from pointer without a cast [-Werror=int-conversion]
         return (NULL);
                ^

    ../port/rt/mqueue.c: In function 'mq_getmsg':
    ../port/rt/mqueue.c:263:35: error: comparison between pointer and integer [-Werror]
      if ((*headpp = curbuf->msg_next) == NULL) {
                                       ^~
    ../port/rt/mqueue.c:278:11: error: assignment makes integer from pointer without a cast [-Werror=int-conversion]
       *tailpp = NULL;
               ^
    ../port/rt/mqueue.c: In function 'mq_putmsg':
    ../port/rt/mqueue.c:315:19: error: assignment makes integer from pointer without a cast [-Werror=int-conversion]
      curbuf->msg_next = 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/sys/siginfo.h:34,
                     from /code/illumos-gate/proto/root_i386/usr/include/sys/signal.h:59,
                     from /code/illumos-gate/proto/root_i386/usr/include/thread.h:41,
                     from /code/illumos-gate/usr/src/lib/libc/inc/mtlib.h:32,
                     from ../port/print/doprnt.c:35:
    ../port/print/doprnt.c: In function '_ndoprnt':
    /code/illumos-gate/proto/root_i386/usr/include/sys/null.h:32:14: error: passing argument 3 of 'mbstowcs' makes integer from pointer without a cast [-Werror=int-conversion]
     #define NULL ((void *)0)
                  ^
    ../port/print/doprnt.c:1907:30: note: in expansion of macro 'NULL'
               mbstowcs(NULL, bp, NULL)) ==
                                  ^~~~
    In file included from /code/illumos-gate/proto/root_i386/usr/include/stdlib.h:37:0,
                     from /code/illumos-gate/proto/root_i386/usr/include/libnvpair.h:30,
                     from /code/illumos-gate/usr/src/lib/libc/inc/libc.h:52,
                     from ../port/print/doprnt.c:38:
    /code/illumos-gate/proto/root_i386/usr/include/iso/stdlib_iso.h:144:15: note: expected 'size_t {aka unsigned int}' but argument is of type 'void *'
     extern size_t mbstowcs(wchar_t *_RESTRICT_KYWD, const char *_RESTRICT_KYWD,
                   ^~~~~~~~

    ../port/inet/inet_network.c: In function 'inet_network':
    ../port/inet/inet_network.c:71:19: error: comparison between pointer and integer [-Werror]
      while ((c = *cp) != NULL) {
                       ^~
    ../port/locale/strptime.c: In function '__strptime':
    ../port/locale/strptime.c:429:13: error: comparison between pointer and integer [-Werror]
        if (*buf == NULL || isspace(*buf))
                 ^~

    ../port/gen/fmtmsg.c: In function 'writemsg':
    ../port/gen/fmtmsg.c:995:20: error: comparison between pointer and integer [-Werror]
       for (c = *p++; c != NULL && buf < ebuf; c = *p++) {
                        ^~
    ../port/gen/fmtmsg.c:1020:20: error: comparison between pointer and integer [-Werror]
       for (c = *p++; c != NULL && buf < ebuf; c = *p++) {
                        ^~

    ../port/gen/getutx.c: In function 'pututxline':
    ../port/gen/getutx.c:661:29: error: comparison between pointer and integer [-Werror]
        if (lockf(fd, F_LOCK, 0) < 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 ../port/gen/event_port.c:30:
    ../port/gen/event_port.c: In function 'port_get':
    /code/illumos-gate/proto/root_i386/usr/include/sys/null.h:32:14: error: passing argument 6 of '_portfs' makes integer from pointer without a cast [-Werror=int-conversion]
     #define NULL ((void *)0)
                  ^
    ../port/gen/event_port.c:76:59: note: in expansion of macro 'NULL'
       r.r_vals = _portfs(PORT_GET, port, (uintptr_t)pe, 0, 0, NULL);
                                                               ^~~~
    In file included from ../port/gen/event_port.c:38:0:
    /code/illumos-gate/usr/src/lib/libc/inc/libc.h:231:16: note: expected 'uintptr_t {aka unsigned int}' but argument is of type 'void *'
     extern int64_t _portfs(int, uintptr_t, uintptr_t, uintptr_t, uintptr_t,
                    ^~~~~~~
    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 ../port/gen/event_port.c:30:
    ../port/gen/event_port.c: In function 'port_send':
    /code/illumos-gate/proto/root_i386/usr/include/sys/null.h:32:14: error: passing argument 5 of '_portfs' makes integer from pointer without a cast [-Werror=int-conversion]
     #define NULL ((void *)0)
                  ^
    ../port/gen/event_port.c:115:63: note: in expansion of macro 'NULL'
      r.r_vals = _portfs(PORT_SEND, port, events, (uintptr_t)user, NULL,
                                                                   ^~~~
    In file included from ../port/gen/event_port.c:38:0:
    /code/illumos-gate/usr/src/lib/libc/inc/libc.h:231:16: note: expected 'uintptr_t {aka unsigned int}' but argument is of type 'void *'
     extern int64_t _portfs(int, uintptr_t, uintptr_t, uintptr_t, uintptr_t,
                    ^~~~~~~
    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 ../port/gen/event_port.c:30:
    /code/illumos-gate/proto/root_i386/usr/include/sys/null.h:32:14: error: passing argument 6 of '_portfs' makes integer from pointer without a cast [-Werror=int-conversion]
     #define NULL ((void *)0)
                  ^
    ../port/gen/event_port.c:116:6: note: in expansion of macro 'NULL'
          NULL);
          ^~~~
    In file included from ../port/gen/event_port.c:38:0:
    /code/illumos-gate/usr/src/lib/libc/inc/libc.h:231:16: note: expected 'uintptr_t {aka unsigned int}' but argument is of type 'void *'
     extern int64_t _portfs(int, uintptr_t, uintptr_t, uintptr_t, uintptr_t,
                    ^~~~~~~
    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 ../port/gen/event_port.c:30:
    ../port/gen/event_port.c: In function 'port_alert':
    /code/illumos-gate/proto/root_i386/usr/include/sys/null.h:32:14: error: passing argument 6 of '_portfs' makes integer from pointer without a cast [-Werror=int-conversion]
     #define NULL ((void *)0)
                  ^
    ../port/gen/event_port.c:182:6: note: in expansion of macro 'NULL'
          NULL);
          ^~~~
    In file included from ../port/gen/event_port.c:38:0:
    /code/illumos-gate/usr/src/lib/libc/inc/libc.h:231:16: note: expected 'uintptr_t {aka unsigned int}' but argument is of type 'void *'
     extern int64_t _portfs(int, uintptr_t, uintptr_t, uintptr_t, uintptr_t,
                    ^~~~~~~

    ../port/gen/crypt.c: In function 'free_crypt_alg':
    ../port/gen/crypt.c:700:21: error: comparison between pointer and integer [-Werror]
      if (alg->a_nparams != NULL) {
                         ^~
    cc1: all warnings being treated as errors

History

#1

Updated by Electric Monk 4 months ago

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

git commit e86c3f00315e5838c0ec0b14f34b94c292085956

commit  e86c3f00315e5838c0ec0b14f34b94c292085956
Author: Toomas Soome <tsoome@me.com>
Date:   2019-06-18T18:14:09.000Z

    11091 libc: NULL pointer errors
    Reviewed by: Norm Jacobs <naj@snapcon.com>
    Approved by: Dan McDonald <danmcd@joyent.com>

Also available in: Atom PDF