Project

General

Profile

Actions

Bug #11442

closed

truss: NULL pointer errors

Added by Toomas Soome about 4 years ago. Updated about 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
cmd - userland programs
Start date:
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:
External Bug:

Description

Build errors with NULL pointer:

    ../stat.c: In function 'show_stat64':
    ../stat.c:157:13: error: comparison between pointer and integer [-Werror]
      if (offset != NULL &&
                 ^~

    ../expound.c: In function 'show_ustat32':
    ../expound.c:420:13: error: comparison between pointer and integer [-Werror]
      if (offset != NULL &&
                 ^~
    ../expound.c: In function 'print_strbuf32':
    ../expound.c:902:14: error: comparison between pointer and integer [-Werror]
      if (sp->buf == NULL || sp->len <= 0)
                  ^~
    ../expound.c: In function 'show_statvfs32':
    ../expound.c:1564:56: error: comparison between pointer and integer [-Werror]
      if (pri->sys_nargs > 1 && (offset = pri->sys_args[1]) != NULL &&
                                                            ^~
    ../expound.c: In function 'show_statfs32':
    ../expound.c:1680:57: error: comparison between pointer and integer [-Werror]
      if (pri->sys_nargs >= 2 && (offset = pri->sys_args[1]) != NULL &&
                                                             ^~
    ../expound.c: In function 'show_msgctl32':
    ../expound.c:2241:13: error: comparison between pointer and integer [-Werror]
      if (offset != NULL &&
                 ^~
    ../expound.c: In function 'show_msgbuf32':
    ../expound.c:2291:13: error: comparison between pointer and integer [-Werror]
      if (offset != NULL &&
                 ^~
    ../expound.c: In function 'show_semctl32':
    ../expound.c:2451:13: error: comparison between pointer and integer [-Werror]
      if (offset != NULL &&
                 ^~
    ../expound.c: In function 'show_shmctl32':
    ../expound.c:2604:13: error: comparison between pointer and integer [-Werror]
      if (offset != NULL &&
                 ^~
    ../expound.c: In function 'show_sigaction32':
    ../expound.c:2776:13: error: comparison between pointer and integer [-Werror]
       if (odisp != NULL)
                 ^~
    ../expound.c: In function 'show_siginfo32':
    ../expound.c:3136:13: error: comparison between pointer and integer [-Werror]
      if (offset != NULL &&
                 ^~
    ../expound.c: In function 'show_iovec32':
    ../expound.c:3201:13: error: comparison between pointer and integer [-Werror]
      if (offset != NULL && niov > 0 &&
                 ^~
    ../expound.c: In function 'show_msghdr32':
    ../expound.c:3609:19: error: comparison between pointer and integer [-Werror]
      if (msg.msg_name != NULL && msg.msg_namelen != 0)
                       ^~

    ../stat.c: In function 'show_stat32':
    ../stat.c:68:13: error: comparison between pointer and integer [-Werror]
      if (offset != NULL &&
                 ^~
    ../stat.c: In function 'show_stat64_32':
    ../stat.c:113:13: error: comparison between pointer and integer [-Werror]
      if (offset != NULL &&
                 ^~

    ../systable.c: In function 'getsubcode':
    ../systable.c:1368:41: error: comparison between pointer and integer [-Werror]
        if (nsysarg > 1 && Lsp->pr_sysarg[1] == NULL) {
                                             ^~
    ../systable.c:1382:41: error: comparison between pointer and integer [-Werror]
        if (nsysarg > 1 && Lsp->pr_sysarg[1] == NULL) {
                                             ^~
    ../systable.c:1427:41: error: comparison between pointer and integer [-Werror]
        if (nsysarg > 1 && Lsp->pr_sysarg[1] == NULL) {
                                             ^~

    ../print.c: In function 'print_pck':
    ../print.c:1493:23: error: comparison between pointer and integer [-Werror]
      if (pri->sys_args[3] == NULL) {
                           ^~

    ../expound.c: In function 'show_timeofday':
    ../expound.c:205:56: error: comparison between pointer and integer [-Werror]
      if (pri->sys_nargs < 1 || (offset = pri->sys_args[0]) == NULL)
                                                            ^~
    ../expound.c: In function 'show_times':
    ../expound.c:333:56: error: comparison between pointer and integer [-Werror]
      if (pri->sys_nargs < 1 || (offset = pri->sys_args[0]) == NULL)
                                                            ^~
    ../expound.c: In function 'show_uname':
    ../expound.c:383:13: error: comparison between pointer and integer [-Werror]
      if (offset != NULL &&
                 ^~
    ../expound.c: In function 'show_ustat':
    ../expound.c:402:13: error: comparison between pointer and integer [-Werror]
      if (offset != NULL &&
                 ^~
    ../expound.c: In function 'show_statvfs':
    ../expound.c:1518:56: error: comparison between pointer and integer [-Werror]
      if (pri->sys_nargs > 1 && (offset = pri->sys_args[1]) != NULL &&
                                                            ^~
    ../expound.c: In function 'show_statvfs64':
    ../expound.c:1610:56: error: comparison between pointer and integer [-Werror]
      if (pri->sys_nargs > 1 && (offset = pri->sys_args[1]) != NULL &&
                                                            ^~
    ../expound.c: In function 'show_statfs':
    ../expound.c:1654:57: error: comparison between pointer and integer [-Werror]
      if (pri->sys_nargs >= 2 && (offset = pri->sys_args[1]) != NULL &&
                                                             ^~
    ../expound.c: In function 'show_fcntl':
    ../expound.c:1865:56: error: comparison between pointer and integer [-Werror]
      if (pri->sys_nargs < 3 || (offset = pri->sys_args[2]) == NULL)
                                                            ^~
    ../expound.c: In function 'show_gp_msg':
    ../expound.c:1987:57: error: comparison between pointer and integer [-Werror]
      if (pri->sys_nargs >= 2 && (offset = pri->sys_args[1]) != NULL)
                                                             ^~
    ../expound.c:1989:57: error: comparison between pointer and integer [-Werror]
      if (pri->sys_nargs >= 3 && (offset = pri->sys_args[2]) != NULL)
                                                             ^~
    ../expound.c: In function 'show_pollsys':
    ../expound.c:2121:13: error: comparison between pointer and integer [-Werror]
      if (offset != NULL && nfds > 32) {
                 ^~
    ../expound.c:2126:13: error: comparison between pointer and integer [-Werror]
      if (offset != NULL && nfds > 0)
                 ^~
    ../expound.c: In function 'show_msgctl64':
    ../expound.c:2193:13: error: comparison between pointer and integer [-Werror]
      if (offset != NULL &&
                 ^~
    ../expound.c: In function 'show_msgctl':
    ../expound.c:2216:13: error: comparison between pointer and integer [-Werror]
      if (offset != NULL &&
                 ^~
    ../expound.c: In function 'show_msgbuf':
    ../expound.c:2266:13: error: comparison between pointer and integer [-Werror]
      if (offset != NULL &&
                 ^~
    ../expound.c: In function 'show_semctl64':
    ../expound.c:2416:13: error: comparison between pointer and integer [-Werror]
      if (offset != NULL &&
                 ^~
    ../expound.c: In function 'show_semctl':
    ../expound.c:2432:13: error: comparison between pointer and integer [-Werror]
      if (offset != NULL &&
                 ^~
    ../expound.c: In function 'show_shmctl64':
    ../expound.c:2555:13: error: comparison between pointer and integer [-Werror]
      if (offset != NULL &&
                 ^~
    ../expound.c: In function 'show_shmctl':
    ../expound.c:2579:13: error: comparison between pointer and integer [-Werror]
      if (offset != NULL &&
                 ^~
    ../expound.c: In function 'show_groups':
    ../expound.c:2675:26: error: comparison between pointer and integer [-Werror]
      if (count > 0 && offset != NULL &&
                              ^~
    ../expound.c: In function 'show_sigset':
    ../expound.c:2717:13: error: comparison between pointer and integer [-Werror]
      if (offset != NULL &&
                 ^~
    ../expound.c: In function 'show_sigaltstack':
    ../expound.c:2754:13: error: comparison between pointer and integer [-Werror]
      if (offset != NULL &&
                 ^~
    ../expound.c: In function 'show_sigaction':
    ../expound.c:2800:13: error: comparison between pointer and integer [-Werror]
      if (offset != NULL &&
                 ^~
    ../expound.c:2804:13: error: comparison between pointer and integer [-Werror]
       if (odisp != NULL)
                 ^~
    ../expound.c: In function 'show_siginfo':
    ../expound.c:3153:13: error: comparison between pointer and integer [-Werror]
      if (offset != NULL &&
                 ^~
    ../expound.c: In function 'show_iovec':
    ../expound.c:3247:13: error: comparison between pointer and integer [-Werror]
      if (offset != NULL && niov > 0 &&
                 ^~
    ../expound.c: In function 'show_rlimit32':
    ../expound.c:3396:13: error: comparison between pointer and integer [-Werror]
      if (offset != NULL &&
                 ^~
    ../expound.c: In function 'show_rlimit64':
    ../expound.c:3435:13: error: comparison between pointer and integer [-Werror]
      if (offset != NULL &&
                 ^~
    ../expound.c: In function 'show_nuname':
    ../expound.c:3476:13: error: comparison between pointer and integer [-Werror]
      if (offset != NULL &&
                 ^~
    ../expound.c: In function 'show_sockaddr':
    ../expound.c:3549:24: error: assignment makes integer from pointer without a cast [-Werror=int-conversion]
        soun->sun_path[len] = NULL;
                            ^
    ../expound.c: In function 'show_ntp_gettime':
    ../expound.c:4194:56: error: comparison between pointer and integer [-Werror]
      if (pri->sys_nargs < 1 || (offset = pri->sys_args[0]) == NULL)
                                                            ^~
    ../expound.c: In function 'show_ntp_adjtime':
    ../expound.c:4298:56: error: comparison between pointer and integer [-Werror]
      if (pri->sys_nargs < 1 || (offset = pri->sys_args[0]) == NULL)
                                                            ^~
    ../expound.c: In function 'show_rctls':
    ../expound.c:4711:24: error: comparison between pointer and integer [-Werror]
       if (pri->sys_args[2] != NULL) {
                            ^~
    ../expound.c:4716:24: error: comparison between pointer and integer [-Werror]
       if (pri->sys_args[3] != NULL) {
                            ^~
    In file included from /code/illumos-gate/proto/root_i386/usr/include/iso/stdio_iso.h:53:0,
                     from /code/illumos-gate/proto/root_i386/usr/include/stdio.h:82,
                     from ../expound.c:34:
    ../expound.c: In function 'expound':
    /code/illumos-gate/proto/root_i386/usr/include/sys/null.h:28:14: error: passing argument 4 of 'show_sigaction' makes integer from pointer without a cast [-Werror=int-conversion]
     #define NULL ((void *)0)
                  ^
    ../expound.c:5334:15: note: in expansion of macro 'NULL'
            "new", NULL);
                   ^~~~
    ../expound.c:2790:1: note: expected 'long int' but argument is of type 'void *'
     show_sigaction(private_t *pri, long offset, const char *name, long odisp)
     ^~~~~~~~~~~~~~
    cc1: all warnings being treated as errors

Actions #1

Updated by Toomas Soome about 4 years ago

Testing done: have built binaries from master and patch branches and run wsdiff.

tsoome@beastie:/code/11442/usr/src/cmd$ wsdiff -vr /tmp/report.txt truss /tmp/truss
truss/amd64/.make.state
truss/systable.c
truss/i386/.make.state
truss/stat.c
truss/.make.state
truss/print.c
truss/expound.c
tsoome@beastie:/code/11442/usr/src/cmd$

Actions #2

Updated by Electric Monk about 4 years ago

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

git commit 27aa48129e712ec06bc239dce1a21a4ae5b19994

commit  27aa48129e712ec06bc239dce1a21a4ae5b19994
Author: Toomas Soome <tsoome@me.com>
Date:   2019-08-01T16:49:16.000Z

    11442 truss: NULL pointer errors
    Reviewed by: Andy Fiddaman <andy@omniosce.org>
    Approved by: Dan McDonald <danmcd@joyent.com>

Actions

Also available in: Atom PDF