Task #83632 - libieee1284-0.2.11-47.fc43/scan-results.err

back to task #83632
download
Error: COMPILER_WARNING (CWE-252):
libieee1284-0.2.11/src/access_io.c: scope_hint: In function 'port_inb'
libieee1284-0.2.11/src/access_io.c:171:5: warning[-Wunused-result]: ignoring return value of 'read' declared with attribute 'warn_unused_result'
#  171 |     read (port->fd, &byte, 1);
#      |     ^~~~~~~~~~~~~~~~~~~~~~~~~
#  169|   
#  170|     if (lseek (port->fd, addr, SEEK_SET) != (off_t)-1)
#  171|->     read (port->fd, &byte, 1);
#  172|   
#  173|     return byte;

Error: COMPILER_WARNING (CWE-252):
libieee1284-0.2.11/src/access_io.c: scope_hint: In function 'port_outb'
libieee1284-0.2.11/src/access_io.c:181:5: warning[-Wunused-result]: ignoring return value of 'write' declared with attribute 'warn_unused_result'
#  181 |     write (port->fd, &val, 1);
#      |     ^~~~~~~~~~~~~~~~~~~~~~~~~
#  179|   {
#  180|     if (lseek (port->fd, addr, SEEK_SET) != (off_t)-1)
#  181|->     write (port->fd, &val, 1);
#  182|   }
#  183|   

Error: COMPILER_WARNING:
libieee1284-0.2.11/src/default.c: scope_hint: In function 'default_nibble_read'
libieee1284-0.2.11/src/default.c:371:22: warning[-Wformat=]: format '%d' expects argument of type 'int', but argument 2 has type 'size_t' {aka 'long unsigned int'}
#  371 |   debugprintf ("<== %d\n", len);
#      |                     ~^     ~~~
#      |                      |     |
#      |                      int   size_t {aka long unsigned int}
#      |                     %ld
#  369|       }
#  370|   
#  371|->   debugprintf ("<== %d\n", len);
#  372|     return len; 
#  373|   

Error: COMPILER_WARNING:
libieee1284-0.2.11/src/default.c:376:22: warning[-Wformat=]: format '%d' expects argument of type 'int', but argument 2 has type 'size_t' {aka 'long unsigned int'}
#  376 |   debugprintf ("<== %d (terminated on error)\n", count);
#      |                     ~^                           ~~~~~
#      |                      |                           |
#      |                      int                         size_t {aka long unsigned int}
#      |                     %ld
#  374|    error:
#  375|     fn->terminate (port);
#  376|->   debugprintf ("<== %d (terminated on error)\n", count);
#  377|     return count;
#  378|   }

Error: COMPILER_WARNING:
libieee1284-0.2.11/src/default.c: scope_hint: In function 'default_compat_write'
libieee1284-0.2.11/src/default.c:417:22: warning[-Wformat=]: format '%d' expects argument of type 'int', but argument 2 has type 'size_t' {aka 'long unsigned int'}
#  417 |   debugprintf ("<== %d\n", len);
#      |                     ~^     ~~~
#      |                      |     |
#      |                      int   size_t {aka long unsigned int}
#      |                     %ld
#  415|       }
#  416|   
#  417|->   debugprintf ("<== %d\n", len);
#  418|     return len;
#  419|   

Error: COMPILER_WARNING:
libieee1284-0.2.11/src/default.c:422:22: warning[-Wformat=]: format '%d' expects argument of type 'int', but argument 2 has type 'size_t' {aka 'long unsigned int'}
#  422 |   debugprintf ("<== %d (terminated on error)\n", count);
#      |                     ~^                           ~~~~~
#      |                      |                           |
#      |                      int                         size_t {aka long unsigned int}
#      |                     %ld
#  420|    error:
#  421|     fn->terminate (port);
#  422|->   debugprintf ("<== %d (terminated on error)\n", count);
#  423|     return count;  
#  424|   }

Error: COMPILER_WARNING (CWE-681):
libieee1284-0.2.11/src/default.c: scope_hint: In function 'default_byte_read'
libieee1284-0.2.11/src/default.c:432:24: warning[-Wpointer-sign]: pointer targets in initialization of 'unsigned char *' from 'char *' differ in signedness
#  432 |   unsigned char *buf = buffer;
#      |                        ^~~~~~
#  430|   
#  431|     const struct parport_access_methods *fn = port->fn;
#  432|->   unsigned char *buf = buffer;
#  433|     size_t count = 0;
#  434|     struct timeval tv;

Error: COMPILER_WARNING:
libieee1284-0.2.11/src/default.c:488:22: warning[-Wformat=]: format '%d' expects argument of type 'int', but argument 2 has type 'size_t' {aka 'long unsigned int'}
#  488 |   debugprintf ("<== %d default_byte_read\n", count);
#      |                     ~^                       ~~~~~
#      |                      |                       |
#      |                      int                     size_t {aka long unsigned int}
#      |                     %ld
#  486|     }
#  487|   
#  488|->   debugprintf ("<== %d default_byte_read\n", count);
#  489|   
#  490|     return count;

Error: COMPILER_WARNING (CWE-681):
libieee1284-0.2.11/src/default.c: scope_hint: In function 'default_epp_read_data'
libieee1284-0.2.11/src/default.c:499:24: warning[-Wpointer-sign]: pointer targets in initialization of 'unsigned char *' from 'char *' differ in signedness
#  499 |   unsigned char *buf = buffer;
#      |                        ^~~~~~
#  497|   {
#  498|     const struct parport_access_methods *fn = port->fn;
#  499|->   unsigned char *buf = buffer;
#  500|     ssize_t count = 0;
#  501|     struct timeval tv;

Error: COMPILER_WARNING:
libieee1284-0.2.11/src/default.c: scope_hint: In function 'default_epp_write_data'
libieee1284-0.2.11/src/default.c:606:22: warning[-Wformat=]: format '%d' expects argument of type 'int', but argument 2 has type 'ssize_t' {aka 'long int'}
#  606 |   debugprintf ("<== %d\n", ret);
#      |                     ~^     ~~~
#      |                      |     |
#      |                      int   ssize_t {aka long int}
#      |                     %ld
#  604|       }
#  605|   
#  606|->   debugprintf ("<== %d\n", ret);
#  607|     return ret;
#  608|   }

Error: COMPILER_WARNING (CWE-681):
libieee1284-0.2.11/src/default.c: scope_hint: In function 'default_ecp_read_data'
libieee1284-0.2.11/src/default.c:633:24: warning[-Wpointer-sign]: pointer targets in initialization of 'unsigned char *' from 'char *' differ in signedness
#  633 |   unsigned char *buf = buffer;
#      |                        ^~~~~~
#  631|     const struct parport_access_methods *fn = port->fn;
#  632|     
#  633|->   unsigned char *buf = buffer;
#  634|     size_t rle_count = 0; /* shut gcc up */
#  635|     int rle = 0;

Error: COMPILER_WARNING:
libieee1284-0.2.11/src/default.c:687:32: warning[-Wformat=]: format '%d' expects argument of type 'int', but argument 2 has type 'size_t' {aka 'long unsigned int'}
#  687 |         debugprintf ("Leaving %d RLE bytes for next time\n",
#      |                               ~^
#      |                                |
#      |                                int
#      |                               %ld
#  688 |             rle_count);
#      |             ~~~~~~~~~           
#      |             |
#      |             size_t {aka long unsigned int}
#  685|         /* Are we allowed to read that many bytes? */
#  686|         if (rle_count > (len - count)) {
#  687|-> 	debugprintf ("Leaving %d RLE bytes for next time\n", 
#  688|   	    rle_count);
#  689|   	break;

Error: COMPILER_WARNING:
libieee1284-0.2.11/src/default.c:722:38: warning[-Wformat=]: format '%d' expects argument of type 'int', but argument 2 has type 'size_t' {aka 'long unsigned int'}
#  722 |       debugprintf ("Decompressed to %d bytes\n", rle_count);
#      |                                     ~^           ~~~~~~~~~
#      |                                      |           |
#      |                                      int         size_t {aka long unsigned int}
#      |                                     %ld
#  720|         buf += rle_count;
#  721|         count += rle_count;
#  722|->       debugprintf ("Decompressed to %d bytes\n", rle_count);
#  723|       } else {
#  724|         /* Normal data byte. */

Error: COMPILER_WARNING (CWE-681):
libieee1284-0.2.11/src/default.c: scope_hint: In function 'default_ecp_write_data'
libieee1284-0.2.11/src/default.c:744:30: warning[-Wpointer-sign]: pointer targets in initialization of 'const unsigned char *' from 'const char *' differ in signedness
#  744 |   const unsigned char *buf = buffer;
#      |                              ^~~~~~
#  742|   
#  743|     const struct parport_access_methods *fn = port->fn;
#  744|->   const unsigned char *buf = buffer;
#  745|     size_t written;
#  746|     int retry;

Error: COMPILER_WARNING (CWE-681):
libieee1284-0.2.11/src/default.c: scope_hint: In function 'default_ecp_write_addr'
libieee1284-0.2.11/src/default.c:827:30: warning[-Wpointer-sign]: pointer targets in initialization of 'const unsigned char *' from 'const char *' differ in signedness
#  827 |   const unsigned char *buf = buffer;
#      |                              ^~~~~~
#  825|   {
#  826|     const struct parport_access_methods *fn = port->fn;
#  827|->   const unsigned char *buf = buffer;
#  828|     size_t written;
#  829|     int retry;

Error: COMPILER_WARNING:
libieee1284-0.2.11/src/deviceid.c: scope_hint: In function 'get_fresh'
libieee1284-0.2.11/src/deviceid.c:88:22: warning[-Wformat=]: format '%d' expects argument of type 'int', but argument 2 has type 'ssize_t' {aka 'long int'}
#   88 |   debugprintf ("<== %d\n", got);
#      |                     ~^     ~~~
#      |                      |     |
#      |                      int   ssize_t {aka long int}
#      |                     %ld
#   86|   
#   87|     ieee1284_terminate (port);
#   88|->   debugprintf ("<== %d\n", got);
#   89|     return got;
#   90|   }

Error: GCC_ANALYZER_WARNING (CWE-401):
libieee1284-0.2.11/src/ports.c: scope_hint: In function 'add_port'
libieee1284-0.2.11/src/ports.c:65:1: warning[-Wanalyzer-malloc-leak]: leak of 'p'
#   63|   {
#   64|     qsort (list->portv, list->portc, sizeof (struct parport *), compare_port);
#   65|-> }
#   66|   
#   67|   static int

Error: COMPILER_WARNING:
libieee1284-0.2.11/src/ports.c: scope_hint: In function 'populate_from_parport.isra.0'
libieee1284-0.2.11/src/ports.c:183:45: warning[-Wformat-overflow=]: '%s' directive writing up to 255 bytes into a region of size 38
#  183 |               sprintf (device, "/dev/parport%s", de->d_name);
#      |                                             ^~
/usr/include/bits/stdio2.h:30:10: note: '__sprintf_chk' output between 13 and 268 bytes into a destination of size 50
#   30 |   return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
#      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#   31 |                                   __glibc_objsize (__s), __fmt,
#      |                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#   32 |                                   __va_arg_pack ());
#      |                                   ~~~~~~~~~~~~~~~~~
#  181|   	  if (capabilities & PPDEV_CAPABLE)
#  182|   	    {
#  183|-> 	      sprintf (device, "/dev/parport%s", de->d_name);
#  184|   	      sprintf (udevice, "/dev/parports/%s", de->d_name);
#  185|   	    }

Error: COMPILER_WARNING:
libieee1284-0.2.11/src/ports.c: scope_hint: In function 'populate_from_parport.isra.0'
libieee1284-0.2.11/src/ports.c:184:48: warning[-Wformat-overflow=]: '%s' directive writing up to 255 bytes into a region of size 36
#  184 |               sprintf (udevice, "/dev/parports/%s", de->d_name);
#      |                                                ^~
/usr/include/bits/stdio2.h:30:10: note: '__sprintf_chk' output between 15 and 270 bytes into a destination of size 50
#   30 |   return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
#      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#   31 |                                   __glibc_objsize (__s), __fmt,
#      |                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#   32 |                                   __va_arg_pack ());
#      |                                   ~~~~~~~~~~~~~~~~~
#  182|   	    {
#  183|   	      sprintf (device, "/dev/parport%s", de->d_name);
#  184|-> 	      sprintf (udevice, "/dev/parports/%s", de->d_name);
#  185|   	    }
#  186|   	  else

Error: COMPILER_WARNING:
libieee1284-0.2.11/src/ports.c: scope_hint: In function 'populate_from_parport.isra.0'
libieee1284-0.2.11/src/ports.c:195:45: warning[-Wformat-overflow=]: '%s' directive writing up to 255 bytes into a region of size 36
#  195 |           sprintf (hardware, "/proc/parport/%s/hardware", de->d_name);
#      |                                             ^~
/usr/include/bits/stdio2.h:30:10: note: '__sprintf_chk' output between 24 and 279 bytes into a destination of size 50
#   30 |   return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
#      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#   31 |                                   __glibc_objsize (__s), __fmt,
#      |                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#   32 |                                   __va_arg_pack ());
#      |                                   ~~~~~~~~~~~~~~~~~
#  193|   
#  194|   	  /* Base and interrupt */
#  195|-> 	  sprintf (hardware, "/proc/parport/%s/hardware", de->d_name);
#  196|   	  fd = open (hardware, O_RDONLY | O_NOCTTY);
#  197|   	  if (fd >= 0)

Error: CLANG_WARNING:
libieee1284-0.2.11/src/ports.c:374:17: warning[unix.MallocSizeof]: Result of 'malloc' is converted to a pointer of type 'struct parport *', which is incompatible with sizeof operand type 'char *'
#  372|   
#  373|     list->portc = 0;
#  374|->   list->portv = malloc (sizeof(char*) * MAX_PORTS);
#  375|     if (!list->portv)
#  376|       return E1284_NOMEM;

Error: CPPCHECK_WARNING (CWE-401):
libieee1284-0.2.11/tests/test.c:72: error[leakNoVarFunctionCall]: Allocation with field, printf doesn't release it.
#   70|   
#   71|         if (ieee1284_get_deviceid (pl->portv[i], -1, F1284_FRESH, id, 500) > -1)
#   72|-> 	printf ("%s, %s %s", field (id, devid_cls), field (id, devid_mfg),
#   73|   		field (id, devid_mdl));
#   74|         else if (ieee1284_get_deviceid (pl->portv[i], -1, 0, id, 500) > -1)

Error: GCC_ANALYZER_WARNING (CWE-401):
libieee1284-0.2.11/tests/test.c: scope_hint: In function ‘test_deviceid’
libieee1284-0.2.11/tests/test.c:72:9: warning[-Wanalyzer-malloc-leak]: leak of ‘field(&id, 0)’
#   70|   
#   71|         if (ieee1284_get_deviceid (pl->portv[i], -1, F1284_FRESH, id, 500) > -1)
#   72|-> 	printf ("%s, %s %s", field (id, devid_cls), field (id, devid_mfg),
#   73|   		field (id, devid_mdl));
#   74|         else if (ieee1284_get_deviceid (pl->portv[i], -1, 0, id, 500) > -1)

Error: GCC_ANALYZER_WARNING (CWE-401):
libieee1284-0.2.11/tests/test.c:72:9: warning[-Wanalyzer-malloc-leak]: leak of ‘field(&id, 1)’
#   70|   
#   71|         if (ieee1284_get_deviceid (pl->portv[i], -1, F1284_FRESH, id, 500) > -1)
#   72|-> 	printf ("%s, %s %s", field (id, devid_cls), field (id, devid_mfg),
#   73|   		field (id, devid_mdl));
#   74|         else if (ieee1284_get_deviceid (pl->portv[i], -1, 0, id, 500) > -1)

Error: CPPCHECK_WARNING (CWE-401):
libieee1284-0.2.11/tests/test.c:73: error[leakNoVarFunctionCall]: Allocation with field, printf doesn't release it.
#   71|         if (ieee1284_get_deviceid (pl->portv[i], -1, F1284_FRESH, id, 500) > -1)
#   72|   	printf ("%s, %s %s", field (id, devid_cls), field (id, devid_mfg),
#   73|-> 		field (id, devid_mdl));
#   74|         else if (ieee1284_get_deviceid (pl->portv[i], -1, 0, id, 500) > -1)
#   75|   	printf ("(may be cached) %s, %s %s", field (id, devid_cls),

Error: CPPCHECK_WARNING (CWE-401):
libieee1284-0.2.11/tests/test.c:75: error[leakNoVarFunctionCall]: Allocation with field, printf doesn't release it.
#   73|   		field (id, devid_mdl));
#   74|         else if (ieee1284_get_deviceid (pl->portv[i], -1, 0, id, 500) > -1)
#   75|-> 	printf ("(may be cached) %s, %s %s", field (id, devid_cls),
#   76|   		field (id, devid_mfg), field (id, devid_mdl));
#   77|         printf ("\n");

Error: GCC_ANALYZER_WARNING (CWE-401):
libieee1284-0.2.11/tests/test.c:75:9: warning[-Wanalyzer-malloc-leak]: leak of ‘field(&id, 0)’
#   73|   		field (id, devid_mdl));
#   74|         else if (ieee1284_get_deviceid (pl->portv[i], -1, 0, id, 500) > -1)
#   75|-> 	printf ("(may be cached) %s, %s %s", field (id, devid_cls),
#   76|   		field (id, devid_mfg), field (id, devid_mdl));
#   77|         printf ("\n");

Error: GCC_ANALYZER_WARNING (CWE-401):
libieee1284-0.2.11/tests/test.c:75:9: warning[-Wanalyzer-malloc-leak]: leak of ‘field(&id, 1)’
#   73|   		field (id, devid_mdl));
#   74|         else if (ieee1284_get_deviceid (pl->portv[i], -1, 0, id, 500) > -1)
#   75|-> 	printf ("(may be cached) %s, %s %s", field (id, devid_cls),
#   76|   		field (id, devid_mfg), field (id, devid_mdl));
#   77|         printf ("\n");

Error: CPPCHECK_WARNING (CWE-401):
libieee1284-0.2.11/tests/test.c:76: error[leakNoVarFunctionCall]: Allocation with field, printf doesn't release it.
#   74|         else if (ieee1284_get_deviceid (pl->portv[i], -1, 0, id, 500) > -1)
#   75|   	printf ("(may be cached) %s, %s %s", field (id, devid_cls),
#   76|-> 		field (id, devid_mfg), field (id, devid_mdl));
#   77|         printf ("\n");
#   78|         for (j = 0; j < 4; j++)

Error: CPPCHECK_WARNING (CWE-401):
libieee1284-0.2.11/tests/test.c:81: error[leakNoVarFunctionCall]: Allocation with field, printf doesn't release it.
#   79|   	if (ieee1284_get_deviceid (pl->portv[i], j, 0, id, 500) > -1)
#   80|   	  printf ("    Daisy chain address %d: (may be cached) %s, %s %s\n", j,
#   81|-> 		  field (id, devid_cls), field (id, devid_mfg),
#   82|   		  field (id, devid_mdl));
#   83|       }

Error: CPPCHECK_WARNING (CWE-401):
libieee1284-0.2.11/tests/test.c:82: error[leakNoVarFunctionCall]: Allocation with field, printf doesn't release it.
#   80|   	  printf ("    Daisy chain address %d: (may be cached) %s, %s %s\n", j,
#   81|   		  field (id, devid_cls), field (id, devid_mfg),
#   82|-> 		  field (id, devid_mdl));
#   83|       }
#   84|     putchar ('\n');

Error: COMPILER_WARNING (CWE-681):
libieee1284-0.2.11/tests/test.c: scope_hint: In function ‘test_open’
libieee1284-0.2.11/tests/test.c:118:35: warning[-Wpointer-sign]: pointer targets in passing argument 3 of ‘ieee1284_open’ differ in signedness
#  118 |       if (ieee1284_open (port, 0, &cap))
#      |                                   ^~~~
#      |                                   |
#      |                                   unsigned int *
libieee1284-0.2.11/tests/test.c:4: included_from: Included from here.
libieee1284-0.2.11/include/ieee1284.h:130:65: note: expected ‘int *’ but argument is of type ‘unsigned int *’
#  130 | extern int ieee1284_open (struct parport *port, int flags, int *capabilities);
#      |                                                            ~~~~~^~~~~~~~~~~~
#  116|         unsigned int cap;
#  117|         /* Just try to open the port, then close it. */
#  118|->       if (ieee1284_open (port, 0, &cap))
#  119|           printf ("%s: inaccessible\n", port->name);
#  120|         else