-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes for issues found with cppcheck tool #4865
Conversation
Nice! This will allow us to add a cppcheck step the to buildbot so we can keep at least keep the code cppcheck clean. This patch does miss one warning in
|
I see, it might be cppcheck version ( |
I was running with |
Ok, I just tried latest v1.74, and it gives two additional hits:
Both of these seem wrong. As if var arg analysis is confused by switch statement somehow. |
char pool[MAXNAMELEN]; | ||
char dataset[MAXNAMELEN]; | ||
char pool[MAXNAMELEN] = { 0 }; | ||
char dataset[MAXNAMELEN] = { 0 }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
= ""
The patch fixes small number of errors/false positives reported by `cppcheck`, static analysis tool for C/C++. cppcheck 1.72 $ cppcheck . --force --quiet [cmd/zfs/zfs_main.c:4444]: (error) Possible null pointer dereference: who_perm [cmd/zfs/zfs_main.c:4445]: (error) Possible null pointer dereference: who_perm [cmd/zfs/zfs_main.c:4446]: (error) Possible null pointer dereference: who_perm [cmd/zpool/zpool_iter.c:317]: (error) Uninitialized variable: nvroot [cmd/zpool/zpool_vdev.c:1526]: (error) Memory leak: child [lib/libefi/rdwr_efi.c:1118]: (error) Memory leak: efi_label [lib/libuutil/uu_misc.c:207]: (error) va_list 'args' was opened but not closed by va_end(). [lib/libzfs/libzfs_import.c:1554]: (error) Dangerous usage of 'diskname' (strncpy doesn't always null-terminate it). [lib/libzfs/libzfs_sendrecv.c:3279]: (error) Dereferencing 'cp' after it is deallocated / released [tests/zfs-tests/cmd/file_write/file_write.c:154]: (error) Possible null pointer dereference: operation [tests/zfs-tests/cmd/randfree_file/randfree_file.c:90]: (error) Memory leak: buf [cmd/zinject/zinject.c:1068]: (error) Uninitialized variable: dataset Issue openzfs#1392 Signed-off-by: Gvozden Neskovic <neskovic@gmail.com>
Merged as: a64f903 Fixes for issues found with cppcheck tool |
The patch fixes small number of errors/false positives reported by
cppcheck
static analysis tool for C/C++.List of errors:
Issue #1392