cppcheck errors

Daniel Gutson daniel.gutson at tallertechnologies.com
Thu Aug 27 21:19:08 UTC 2015


Please note too that there are some false positives, like the realloc one.

On Thu, Aug 27, 2015 at 6:15 PM, Martin Galvan
<martin.galvan at tallertechnologies.com> wrote:
> On Thu, Aug 27, 2015 at 6:10 PM, Daniel Gutson
> <daniel.gutson at tallertechnologies.com> wrote:
>> Maybe we can just provide the list until we provide the fixes? Martín?
>
> Gladly. Keep in mind we ran cppcheck only on the modules we use
> (though some things may've slipped in, like nios):
>
> [c/src/lib/libbsp/shared/umon/umon.h:21]: (error) Invalid number of
> character ({) when these macros are defined: '__cplusplus'.
> [cpukit/libmisc/dumpbuf/dumpbuf.c:69]: (error) Undefined behavior:
> Variable 'line_buffer' is used as parameter and destination in
> s[n]printf().
> [cpukit/libmisc/dumpbuf/dumpbuf.c:76]: (error) Undefined behavior:
> Variable 'line_buffer' is used as parameter and destination in
> s[n]printf().
> [cpukit/libmisc/stackchk/check.c:285] ->
> [cpukit/libmisc/stackchk/check.c:294]: (performance) Variable
> 'pattern_ok' is reassigned a value before the old one has been used.
> [cpukit/libmisc/stackchk/check.c:255]: (portability) 'pattern_area' is
> of type 'void *'. When using void pointers in calculations, the
> behaviour is undefined.
> [cpukit/libnetworking/kern/kern_subr.c:93]: (portability) 'cp' is of
> type 'void *'. When using void pointers in calculations, the behaviour
> is undefined.
> [cpukit/libnetworking/kern/uipc_socket2.c:616]: (error) Uninitialized
> variable: o
> [cpukit/libnetworking/lib/ftpfs.c:704] ->
> [cpukit/libnetworking/lib/ftpfs.c:709]: (performance) Variable
> 'port_socket' is reassigned a value before the old one has been used.
> [cpukit/libnetworking/lib/tftpDriver.c:503]: (error) Common realloc
> mistake: 'current' nulled but not freed upon failure
> [cpukit/libnetworking/libc/ether_addr.c:72]: (portability) scanf
> without field width limits can crash with huge input data on some
> versions of libc.
> [cpukit/libnetworking/libc/ether_addr.c:94]: (portability) scanf
> without field width limits can crash with huge input data on some
> versions of libc.
> [cpukit/libnetworking/libc/gethostbyht.c:233]: (error) Common realloc
> mistake: 'hostmap' nulled but not freed upon failure
> [cpukit/libnetworking/libc/ns_addr.c:112]: (portability) scanf without
> field width limits can crash with huge input data on some versions of
> libc.
> [cpukit/libnetworking/libc/ns_addr.c:120]: (portability) scanf without
> field width limits can crash with huge input data on some versions of
> libc.
> [cpukit/libnetworking/libc/ns_addr.c:128]: (portability) scanf without
> field width limits can crash with huge input data on some versions of
> libc.
> [cpukit/libnetworking/libc/ns_addr.c:137]: (portability) scanf without
> field width limits can crash with huge input data on some versions of
> libc.
> [cpukit/libnetworking/rtems/rtems_dhcp.c:401]: (error) Common realloc
> mistake: 'dhcp_hostname' nulled but not freed upon failure
> [cpukit/librpc/src/rpc/netnamer.c:331]: (error) Resource leak: fd
> [cpukit/posix/include/rtems/posix/ptimer.h:33]: (error) Invalid number
> of character ({) when these macros are defined: '__cplusplus'.
> [cpukit/rtems/include/rtems/rtems/dpmemimpl.h:116]: (error) Invalid
> number of character ({) when these macros are defined: '__cplusplus'.
> [cpukit/score/cpu/h8300/cpu.c:54]: (error) Uninitialized variable:
> _ccr (si no se inicializa, se hace un #warning pero igual existe el
> problema)
> [cpukit/zlib/gzwrite.c:80]: (error) Uninitialized variable: got
> [tools/build/binpatch.c:104]: (error) Resource leak: ifp
> [tools/build/binpatch.c:63]: (error) Uninitialized variable: off
> [tools/build/unhex.c:238]: (error) Resource leak: outfp
> [tools/cpu/nios2/memory.c:99]: (error) Uninitialized variable: memory
> [tools/cpu/nios2/ptf.c:542]: (error) fprintf format string has 1
> parameters but only 0 are given.
> [tools/cpu/nios2/ptf.c:580]: (error) Memory leak: new_prefix



-- 

Daniel F. Gutson
Chief Engineering Officer, SPD

San Lorenzo 47, 3rd Floor, Office 5
Córdoba, Argentina

Phone:   +54 351 4217888 / +54 351 4218211
Skype:    dgutson
LinkedIn: http://ar.linkedin.com/in/danielgutson



More information about the devel mailing list