summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2017-11-18 14:08:00 -0800
committerGitHub <[email protected]>2017-11-18 14:08:00 -0800
commit94183a9d8a1133ff0d29666a86f84c24f2c4083c (patch)
treecb6ad00a71574e618efc4e964f2b1b9b4f89b5bf /lib
parent8d187769736688044c3c58a6a56069a54210a656 (diff)
Update for cppcheck v1.80
Resolve new warnings and errors from cppcheck v1.80. * [lib/libshare/libshare.c:543]: (warning) Possible null pointer dereference: protocol * [lib/libzfs/libzfs_dataset.c:2323]: (warning) Possible null pointer dereference: srctype * [lib/libzfs/libzfs_import.c:318]: (error) Uninitialized variable: link * [module/zfs/abd.c:353]: (error) Uninitialized variable: sg * [module/zfs/abd.c:353]: (error) Uninitialized variable: i * [module/zfs/abd.c:385]: (error) Uninitialized variable: sg * [module/zfs/abd.c:385]: (error) Uninitialized variable: i * [module/zfs/abd.c:553]: (error) Uninitialized variable: i * [module/zfs/abd.c:553]: (error) Uninitialized variable: sg * [module/zfs/abd.c:763]: (error) Uninitialized variable: i * [module/zfs/abd.c:763]: (error) Uninitialized variable: sg * [module/zfs/abd.c:305]: (error) Uninitialized variable: tmp_page * [module/zfs/zpl_xattr.c:342]: (warning) Possible null pointer dereference: value * [module/zfs/zvol.c:208]: (error) Uninitialized variable: p Convert the following suppression to inline. * [module/zfs/zfs_vnops.c:840]: (error) Possible null pointer dereference: aiov Exclude HAVE_UIO_ZEROCOPY and HAVE_DNLC from analysis since these macro's will never be defined until this functionality is implemented. Reviewed-by: George Melikov <[email protected]> Reviewed-by: Giuseppe Di Natale <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #6879
Diffstat (limited to 'lib')
-rw-r--r--lib/libshare/libshare.c37
-rw-r--r--lib/libzfs/libzfs_dataset.c4
-rw-r--r--lib/libzfs/libzfs_import.c2
3 files changed, 8 insertions, 35 deletions
diff --git a/lib/libshare/libshare.c b/lib/libshare/libshare.c
index aa565ca82..022df016f 100644
--- a/lib/libshare/libshare.c
+++ b/lib/libshare/libshare.c
@@ -493,20 +493,10 @@ int
sa_enable_share(sa_share_t share, char *protocol)
{
sa_share_impl_t impl_share = (sa_share_impl_t)share;
- int rc, ret;
- boolean_t found_protocol;
+ int rc, ret = SA_OK;
+ boolean_t found_protocol = B_FALSE;
sa_fstype_t *fstype;
-#ifdef DEBUG
- fprintf(stderr, "sa_enable_share: share->sharepath=%s, protocol=%s\n",
- impl_share->sharepath, protocol);
-#endif
-
- assert(impl_share->handle != NULL);
-
- ret = SA_OK;
- found_protocol = B_FALSE;
-
fstype = fstypes;
while (fstype != NULL) {
if (protocol == NULL || strcmp(fstype->name, protocol) == 0) {
@@ -534,18 +524,10 @@ int
sa_disable_share(sa_share_t share, char *protocol)
{
sa_share_impl_t impl_share = (sa_share_impl_t)share;
- int rc, ret;
- boolean_t found_protocol;
+ int rc, ret = SA_OK;
+ boolean_t found_protocol = B_FALSE;
sa_fstype_t *fstype;
-#ifdef DEBUG
- fprintf(stderr, "sa_disable_share: share->sharepath=%s, protocol=%s\n",
- impl_share->sharepath, protocol);
-#endif
-
- ret = SA_OK;
- found_protocol = B_FALSE;
-
fstype = fstypes;
while (fstype != NULL) {
if (protocol == NULL || strcmp(fstype->name, protocol) == 0) {
@@ -696,11 +678,6 @@ sa_parse_legacy_options(sa_group_t group, char *options, char *proto)
{
sa_fstype_t *fstype;
-#ifdef DEBUG
- fprintf(stderr, "sa_parse_legacy_options: options=%s, proto=%s\n",
- options, proto);
-#endif
-
fstype = fstypes;
while (fstype != NULL) {
if (strcmp(fstype->name, proto) != 0) {
@@ -787,12 +764,6 @@ sa_zfs_process_share(sa_handle_t handle, sa_group_t group, sa_share_t share,
sa_handle_impl_t impl_handle = (sa_handle_impl_t)handle;
sa_share_impl_t impl_share = (sa_share_impl_t)share;
-#ifdef DEBUG
- fprintf(stderr, "sa_zfs_process_share: mountpoint=%s, proto=%s, "
- "shareopts=%s, sourcestr=%s, dataset=%s\n", mountpoint, proto,
- shareopts, sourcestr, dataset);
-#endif
-
return (process_share(impl_handle, impl_share, mountpoint, NULL,
proto, shareopts, NULL, dataset, B_FALSE));
}
diff --git a/lib/libzfs/libzfs_dataset.c b/lib/libzfs/libzfs_dataset.c
index 0a9a4277d..a0a0afe1f 100644
--- a/lib/libzfs/libzfs_dataset.c
+++ b/lib/libzfs/libzfs_dataset.c
@@ -2306,8 +2306,10 @@ static void
get_source(zfs_handle_t *zhp, zprop_source_t *srctype, char *source,
char *statbuf, size_t statlen)
{
- if (statbuf == NULL || *srctype == ZPROP_SRC_TEMPORARY)
+ if (statbuf == NULL ||
+ srctype == NULL || *srctype == ZPROP_SRC_TEMPORARY) {
return;
+ }
if (source == NULL) {
*srctype = ZPROP_SRC_NONE;
diff --git a/lib/libzfs/libzfs_import.c b/lib/libzfs/libzfs_import.c
index e1af795b6..6203cd19b 100644
--- a/lib/libzfs/libzfs_import.c
+++ b/lib/libzfs/libzfs_import.c
@@ -310,7 +310,7 @@ zpool_label_disk_wait(char *path, int timeout_ms)
dev = udev_device_new_from_subsystem_sysname(udev,
"block", sysname);
if ((dev != NULL) && udev_device_is_ready(dev)) {
- struct udev_list_entry *links, *link;
+ struct udev_list_entry *links, *link = NULL;
ret = 0;
links = udev_device_get_devlinks_list_entry(dev);