11170 print: NULL pointer errors

Review Request #1955 — Created June 1, 2019 and submitted

tsoome
illumos-gate
11170
2017, 2016, 2015, 2014
c025d55...
general
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 ../common/lpd-misc.c:31:
../common/lpd-misc.c: In function 'recvfd':
/code/illumos-gate/proto/root_i386/usr/include/sys/null.h:28:14: error: passing argument 2 of 'memset' makes integer from pointer without a cast [-Werror=int-conversion]
 #define NULL ((void *)0)
              ^
../common/lpd-misc.c:86:19: note: in expansion of macro 'NULL'
  memset(&recv_fd, NULL, sizeof (recv_fd));
                   ^~~~
In file included from /code/illumos-gate/proto/root_i386/usr/include/string.h:33:0,
                 from ../common/lpd-misc.c:37:
/code/illumos-gate/proto/root_i386/usr/include/iso/string_iso.h:72:14: note: expected 'int' but argument is of type 'void *'
 extern void *memset(void *, int, size_t);
              ^~~~~~

../common/common.c: In function 'add_supported_locales':
../common/common.c:253:43: error: comparison between pointer and integer [-Werror]
    for (i = 0; ((passed == 1) && (name[i] != NULL)); i++)
                                           ^~

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 ../common/lpd-job.c:32:
../common/lpd-job.c: In function 'lpd_add_svr4_attributes':
/code/illumos-gate/proto/root_i386/usr/include/sys/null.h:28:14: error: passing argument 2 of 'memset' makes integer from pointer without a cast [-Werror=int-conversion]
 #define NULL ((void *)0)
              ^
../common/lpd-job.c:387:14: note: in expansion of macro 'NULL'
  memset(tmp, NULL, sizeof (tmp));
              ^~~~
In file included from /code/illumos-gate/proto/root_i386/usr/include/string.h:33:0,
                 from ../common/lpd-job.c:40:
/code/illumos-gate/proto/root_i386/usr/include/iso/string_iso.h:72:14: note: expected 'int' but argument is of type 'void *'
 extern void *memset(void *, int, size_t);
              ^~~~~~

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 ../common/attribute.c:32:
../common/attribute.c: In function '_process_value':
/code/illumos-gate/proto/root_i386/usr/include/sys/null.h:28:14: error: incompatible types when initializing type 'enum <anonymous>' using type 'void *'
 #define NULL ((void *)0)
              ^
../common/attribute.c:651:3: note: in expansion of macro 'NULL'
   NULL
   ^~~~

../common/ns_cmn_printer.c: In function 'ns_printer_name_list':
../common/ns_cmn_printer.c:154:25: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
  buf[strlen(buf) - 1] = (char)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 ../common/list.c:30:
../common/list.c: In function 'list_append':
/code/illumos-gate/proto/root_i386/usr/include/sys/null.h:28:14: error: passing argument 2 of 'memset' makes integer from pointer without a cast [-Werror=int-conversion]
 #define NULL ((void *)0)
              ^
../common/list.c:61:23: note: in expansion of macro 'NULL'
   (void) memset(list, NULL, (_list_increment * sizeof (void *)));
                       ^~~~
In file included from /code/illumos-gate/proto/root_i386/usr/include/string.h:33:0,
                 from /code/illumos-gate/proto/root_i386/usr/include/strings.h:36,
                 from ../common/list.c:37:
/code/illumos-gate/proto/root_i386/usr/include/iso/string_iso.h:72:14: note: expected 'int' but argument is of type 'void *'
 extern void *memset(void *, int, size_t);
              ^~~~~~
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 ../common/list.c:30:
/code/illumos-gate/proto/root_i386/usr/include/sys/null.h:28:14: error: passing argument 2 of 'memset' makes integer from pointer without a cast [-Werror=int-conversion]
 #define NULL ((void *)0)
              ^
../common/list.c:75:28: note: in expansion of macro 'NULL'
    (void) memset(new_list, NULL,
                            ^~~~
In file included from /code/illumos-gate/proto/root_i386/usr/include/string.h:33:0,
                 from /code/illumos-gate/proto/root_i386/usr/include/strings.h:36,
                 from ../common/list.c:37:
/code/illumos-gate/proto/root_i386/usr/include/iso/string_iso.h:72:14: note: expected 'int' but argument is of type 'void *'
 extern void *memset(void *, int, size_t);
              ^~~~~~
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 ../common/list.c:30:
../common/list.c: In function 'list_concatenate':
/code/illumos-gate/proto/root_i386/usr/include/sys/null.h:28:14: error: passing argument 2 of 'memset' makes integer from pointer without a cast [-Werror=int-conversion]
 #define NULL ((void *)0)
              ^
../common/list.c:149:23: note: in expansion of macro 'NULL'
   (void) memset(list, NULL, (new_size * sizeof (void *)));
                       ^~~~
In file included from /code/illumos-gate/proto/root_i386/usr/include/string.h:33:0,
                 from /code/illumos-gate/proto/root_i386/usr/include/strings.h:36,
                 from ../common/list.c:37:
/code/illumos-gate/proto/root_i386/usr/include/iso/string_iso.h:72:14: note: expected 'int' but argument is of type 'void *'
 extern void *memset(void *, int, size_t);
              ^~~~~~
../common/nss_convert.c: In function 'strncat_escaped':
../common/nss_convert.c:56:13: error: comparison between pointer and integer [-Werror]
  while ((*t != NULL) && (len > 0))
             ^~
../common/nss_convert.c:62:13: error: comparison between pointer and integer [-Werror]
  while ((*s != NULL) && (len > 0)) {
             ^~
../common/nss_convert.c:67:5: error: assignment makes integer from pointer without a cast [-Werror=int-conversion]
  *t = 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 ../common/nss_convert.c:33:
../common/nss_convert.c: In function '_cvt_printer_to_entry':
/code/illumos-gate/proto/root_i386/usr/include/sys/null.h:28:14: error: passing argument 2 of 'memset' makes integer from pointer without a cast [-Werror=int-conversion]
 #define NULL ((void *)0)
              ^
../common/nss_convert.c:80:21: note: in expansion of macro 'NULL'
  (void) memset(buf, NULL, buflen);
                     ^~~~
In file included from /code/illumos-gate/proto/root_i386/usr/include/string.h:33:0,
                 from ../common/nss_convert.c:37:
/code/illumos-gate/proto/root_i386/usr/include/iso/string_iso.h:72:14: note: expected 'int' but argument is of type 'void *'
 extern void *memset(void *, int, size_t);
              ^~~~~~
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 ../common/nss_convert.c:33:
/code/illumos-gate/proto/root_i386/usr/include/sys/null.h:28:14: error: passing argument 2 of 'memset' makes integer from pointer without a cast [-Werror=int-conversion]
 #define NULL ((void *)0)
              ^
../common/nss_convert.c:86:22: note: in expansion of macro 'NULL'
   (void) memset(buf, NULL, buflen);
                      ^~~~
In file included from /code/illumos-gate/proto/root_i386/usr/include/string.h:33:0,
                 from ../common/nss_convert.c:37:
/code/illumos-gate/proto/root_i386/usr/include/iso/string_iso.h:72:14: note: expected 'int' but argument is of type 'void *'
 extern void *memset(void *, int, size_t);
              ^~~~~~
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 ../common/nss_convert.c:33:
/code/illumos-gate/proto/root_i386/usr/include/sys/null.h:28:14: error: passing argument 2 of 'memset' makes integer from pointer without a cast [-Werror=int-conversion]
 #define NULL ((void *)0)
              ^
../common/nss_convert.c:102:22: note: in expansion of macro 'NULL'
   (void) memset(buf, NULL, buflen);
                      ^~~~
In file included from /code/illumos-gate/proto/root_i386/usr/include/string.h:33:0,
                 from ../common/nss_convert.c:37:
/code/illumos-gate/proto/root_i386/usr/include/iso/string_iso.h:72:14: note: expected 'int' but argument is of type 'void *'
 extern void *memset(void *, int, size_t);
              ^~~~~~
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 ../common/nss_convert.c:33:
/code/illumos-gate/proto/root_i386/usr/include/sys/null.h:28:14: error: passing argument 2 of 'memset' makes integer from pointer without a cast [-Werror=int-conversion]
 #define NULL ((void *)0)
              ^
../common/nss_convert.c:124:22: note: in expansion of macro 'NULL'
   (void) memset(buf, NULL, buflen);
                      ^~~~
In file included from /code/illumos-gate/proto/root_i386/usr/include/string.h:33:0,
                 from ../common/nss_convert.c:37:
/code/illumos-gate/proto/root_i386/usr/include/iso/string_iso.h:72:14: note: expected 'int' but argument is of type 'void *'
 extern void *memset(void *, int, size_t);
              ^~~~~~
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 ../common/nss_convert.c:33:
/code/illumos-gate/proto/root_i386/usr/include/sys/null.h:28:14: error: passing argument 2 of 'memset' makes integer from pointer without a cast [-Werror=int-conversion]
 #define NULL ((void *)0)
              ^
../common/nss_convert.c:130:22: note: in expansion of macro 'NULL'
   (void) memset(buf, NULL, buflen);
                      ^~~~
In file included from /code/illumos-gate/proto/root_i386/usr/include/string.h:33:0,
                 from ../common/nss_convert.c:37:
/code/illumos-gate/proto/root_i386/usr/include/iso/string_iso.h:72:14: note: expected 'int' but argument is of type 'void *'
 extern void *memset(void *, int, size_t);
              ^~~~~~
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 ../common/nss_convert.c:33:
../common/nss_convert.c: In function '_cvt_nss_entry_to_printer':
/code/illumos-gate/proto/root_i386/usr/include/sys/null.h:28:14: error: passing argument 2 of 'memset' makes integer from pointer without a cast [-Werror=int-conversion]
 #define NULL ((void *)0)
              ^
../common/nss_convert.c:152:21: note: in expansion of macro 'NULL'
  (void) memset(buf, NULL, sizeof (buf));
                     ^~~~
In file included from /code/illumos-gate/proto/root_i386/usr/include/string.h:33:0,
                 from ../common/nss_convert.c:37:
/code/illumos-gate/proto/root_i386/usr/include/iso/string_iso.h:72:14: note: expected 'int' but argument is of type 'void *'
 extern void *memset(void *, int, size_t);
              ^~~~~~
../common/nss_convert.c:153:23: error: comparison between pointer and integer [-Werror]
  for (cp = entry; *cp != NULL; cp++) {
                       ^~
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 ../common/nss_convert.c:33:
/code/illumos-gate/proto/root_i386/usr/include/sys/null.h:28:14: error: passing argument 2 of 'memset' makes integer from pointer without a cast [-Werror=int-conversion]
 #define NULL ((void *)0)
              ^
../common/nss_convert.c:169:23: note: in expansion of macro 'NULL'
    (void) memset(buf, NULL, sizeof (buf));
                       ^~~~
In file included from /code/illumos-gate/proto/root_i386/usr/include/string.h:33:0,
                 from ../common/nss_convert.c:37:
/code/illumos-gate/proto/root_i386/usr/include/iso/string_iso.h:72:14: note: expected 'int' but argument is of type 'void *'
 extern void *memset(void *, int, size_t);
              ^~~~~~
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 ../common/nss_convert.c:33:
/code/illumos-gate/proto/root_i386/usr/include/sys/null.h:28:14: error: passing argument 2 of 'memset' makes integer from pointer without a cast [-Werror=int-conversion]
 #define NULL ((void *)0)
              ^
../common/nss_convert.c:176:24: note: in expansion of macro 'NULL'
     (void) memset(buf, NULL, sizeof (buf));
                        ^~~~
In file included from /code/illumos-gate/proto/root_i386/usr/include/string.h:33:0,
                 from ../common/nss_convert.c:37:
/code/illumos-gate/proto/root_i386/usr/include/iso/string_iso.h:72:14: note: expected 'int' but argument is of type 'void *'
 extern void *memset(void *, int, size_t);
              ^~~~~~
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 ../common/nss_convert.c:33:
/code/illumos-gate/proto/root_i386/usr/include/sys/null.h:28:14: error: passing argument 2 of 'memset' makes integer from pointer without a cast [-Werror=int-conversion]
 #define NULL ((void *)0)
              ^
../common/nss_convert.c:189:24: note: in expansion of macro 'NULL'
     (void) memset(buf, NULL, sizeof (buf));
                        ^~~~
In file included from /code/illumos-gate/proto/root_i386/usr/include/string.h:33:0,
                 from ../common/nss_convert.c:37:
/code/illumos-gate/proto/root_i386/usr/include/iso/string_iso.h:72:14: note: expected 'int' but argument is of type 'void *'
 extern void *memset(void *, int, size_t);
              ^~~~~~
../common/ns_bsd_addr.c: In function 'string_to_value':
../common/ns_bsd_addr.c:202:54: error: comparison between pointer and integer [-Werror]
  if ((key != NULL) && (string != NULL) && (string[0] != NULL)) {
                                                      ^~
../common/ns_bsd_addr.c: In function 'posix_name':
../common/ns_bsd_addr.c:282:14: error: comparison between pointer and integer [-Werror]
   if (buf[0] != NULL) {
              ^~

../common/nss_write.c: In function 'freadline':
../common/nss_write.c:67:8: error: assignment makes integer from pointer without a cast [-Werror=int-conversion]
     *s = NULL;
        ^
../common/nss_write.c: In function 'nis_put_printer':
../common/nss_write.c:276:8: error: assignment makes integer from pointer without a cast [-Werror=int-conversion]
   *tmp = NULL; /* strip the .byname */
        ^
cc1: all warnings being treated as errors


  • 0
  • 0
  • 23
  • 0
  • 23
Description From Last Updated
domag02
  1. Some c-style and other issues.
  2. This variable used only when FORCE_LPSCHED_URI is defined.

  3. Dead code?

    1. https://www.illumos.org/issues/11269

    1. Possible NULL-pointer dereference:
      From strtok(3C) manual page:

      ...If no such byte is found, the current token extends to the end of the string pointed to by s1, and subsequent searches for a token return a null pointer.

    2. Missing braces.

    1. https://www.illumos.org/issues/11270

  4. "If one arm of an if-else statement contains braces, all arms should contain braces."
  5. "If one arm of an if-else statement contains braces, all arms should contain braces."
  6. Missing blanks around the + operators.

  7. "If one arm of an if-else statement contains braces, all arms should contain braces."
  8. "If one arm of an if-else statement contains braces, all arms should contain braces."
  9. "Each line should contain at most one statement."
  10. Is this memset() necessary after calloc()?

  11. Possible NULL-pointer dereference.
  12. Is this memset() necessary after calloc()?

  13. Possible NULL-pointer dereference.
  14. Is this memset() necessary after calloc()?

  15. "If one arm of an if-else statement contains braces, all arms should contain braces."
  16. Typo, this comment line should be:

     *              ns_bsd_addr_t *a2 - another bsd addr
    
  17. Unnecessary blank line.
  18. "The opening left brace should be at the end of the line beginning the compound statement and the closing right brace
    should be alone on a line, positioned under the beginning of the compound statement."
  19. "...the right brace before the else and the right brace before the while of a do-while
    statement are the only places where a right brace appears that is not alone on a line."
  20. This function declaration should be in /usr/src/lib/print/libprint/common/ns.h, next to the declaration of ns_kvp_create().
    (The same problem can be found in /usr/src/lib/print/libprint/common/ns.c, line: 81.)

  21. "If one arm of an if-else statement contains braces, all arms should contain braces."
  22. "If one arm of an if-else statement contains braces, all arms should contain braces."
  23. "If one arm of an if-else statement contains braces, all arms should contain braces."
  24. Missing blanks around the | operators.

  25. "If one arm of an if-else statement contains braces, all arms should contain braces."
  26. "If one arm of an if-else statement contains braces, all arms should contain braces."
  27. 
      
tsoome
tsoome
tsoome
tsoome
norm
  1. Ship It!
  2. 
      
tsoome
tsoome
Review request changed

Status: Closed (submitted)

Loading...