]> sourceware.org Git - lvm2.git/commitdiff
coverity: fix issues reported by coverity
authorPeter Rajnoha <prajnoha@redhat.com>
Tue, 24 Jun 2014 12:58:53 +0000 (14:58 +0200)
committerPeter Rajnoha <prajnoha@redhat.com>
Tue, 24 Jun 2014 12:58:53 +0000 (14:58 +0200)
daemons/clvmd/clvmd-cman.c
lib/commands/toolcontext.c
lib/config/config.c
lib/metadata/metadata.c
lib/metadata/raid_manip.c
libdaemon/server/daemon-server.c
libdm/libdm-report.c

index e41d0cf77e3fd17e067a6a35c1d672444bdda193..9efa92dce1c08835ad61b9f4d6beaf3aeae348fb 100644 (file)
@@ -110,12 +110,12 @@ static void _cluster_init_completed(void)
        clvmd_cluster_init_completed();
 }
 
-static int _get_main_cluster_fd()
+static int _get_main_cluster_fd(void)
 {
        return cman_get_fd(c_handle);
 }
 
-static int _get_num_nodes()
+static int _get_num_nodes(void)
 {
        int i;
        int nnodes = 0;
@@ -243,7 +243,7 @@ static void _add_up_node(const char *csid)
        DEBUGLOG("Added new node %d to updown list\n", nodeid);
 }
 
-static void _cluster_closedown()
+static void _cluster_closedown(void)
 {
        dlm_release_lockspace(LOCKSPACE_NAME, lockspace, 1);
        cman_finish(c_handle);
@@ -282,7 +282,7 @@ static void count_clvmds_running(void)
 }
 
 /* Get a list of active cluster members */
-static void get_members()
+static void get_members(void)
 {
        int retnodes;
        int status;
@@ -380,7 +380,7 @@ static int nodeid_from_csid(const char *csid)
        return nodeid;
 }
 
-static int _is_quorate()
+static int _is_quorate(void)
 {
        return cman_is_quorate(c_handle);
 }
index 326bfe08fa87ca686b2dae9b09594d54ad8238ba..18fa12d15516af8d6a6b6435ddc1bb73d4afc347 100644 (file)
@@ -642,7 +642,10 @@ static int _init_profiles(struct cmd_context *cmd)
                dm_list_init(&cmd->profile_params->profiles);
        }
 
-       dm_strncpy(cmd->profile_params->dir, dir, sizeof(cmd->profile_params->dir));
+       if (!(dm_strncpy(cmd->profile_params->dir, dir, sizeof(cmd->profile_params->dir)))) {
+               log_error("_init_profiles: dm_strncpy failed");
+               return 0;
+       }
 
        return 1;
 }
index ecb674e5f80d51ac4414d17ba4c72cda15e5fe29..2ed3db64140a709a9de5ccccc0325d16ccc2320b 100644 (file)
@@ -334,7 +334,7 @@ struct dm_config_tree *remove_config_tree_by_source(struct cmd_context *cmd,
 struct cft_check_handle *get_config_tree_check_handle(struct cmd_context *cmd,
                                                      struct dm_config_tree *cft)
 {
-       struct config_source *cs = dm_config_get_custom(cft);
+       struct config_source *cs;
 
        if (!(cs = dm_config_get_custom(cft)))
                return NULL;
@@ -438,7 +438,6 @@ static int _override_config_tree_from_metadata_profile(struct cmd_context *cmd,
        if (cs->type == CONFIG_PROFILE_COMMAND) {
                cft_previous = cft;
                cft = cft->cascade;
-               cs = dm_config_get_custom(cft);
        }
 
        cs = dm_config_get_custom(cft);
index 5c0a4744836dc70a8508759087f32265b470407c..599ebb6da968344c387f1d7887b482d59190399c 100644 (file)
@@ -370,7 +370,7 @@ static int _move_pv(struct volume_group *vg_from, struct volume_group *vg_to,
        /* FIXME: handle tags */
        if (!(pvl = find_pv_in_vg(vg_from, pv_name))) {
                if (!enforce_pv_from_source &&
-                   (pvl = find_pv_in_vg(vg_to, pv_name)))
+                   find_pv_in_vg(vg_to, pv_name))
                        /*
                         * PV has already been moved.  This can happen if an
                         * LV is being moved that has multiple sub-LVs on the
index 4c13b66de6060d6fd6142d316e1bacf55736e628..cdfbc846e54573166177e4faf4203a7c4ea485e8 100644 (file)
@@ -865,7 +865,7 @@ static int _raid_extract_images(struct logical_volume *lv, uint32_t new_count,
                            (first_seg(seg_metalv(seg, s))->segtype != error_segtype))
                                continue;
 
-                       if (target_pvs && !dm_list_empty(target_pvs) &&
+                       if (!dm_list_empty(target_pvs) &&
                            (target_pvs != &lv->vg->pvs)) {
                                /*
                                 * User has supplied a list of PVs, but we
index 8ed3cce96dcf395904caf1e6ad58a3d096fcfa11..3b390a3f7b48c3176f8d6fb501e4d740891ca10c 100644 (file)
@@ -497,7 +497,8 @@ static void reap(daemon_state s, int waiting)
 
        while (ts) {
                if (waiting || !ts->active) {
-                       pthread_join(ts->client.thread_id, &rv);
+                       if ((errno = pthread_join(ts->client.thread_id, &rv)))
+                               ERROR(&s, "pthread_join failed: %s", strerror(errno));
                        last->next = ts->next;
                        dm_free(ts);
                } else
index 957a4c918cf91f8f450f1d787bf722ba27fcf070..180bb9b8f573f0e9dbb8a05792b0c3776c41b1e1 100644 (file)
@@ -1050,14 +1050,14 @@ struct dm_report *dm_report_init(uint32_t *report_types,
        struct dm_report *rh;
        const struct dm_report_object_type *type;
 
+       if (_contains_reserved_report_type(types))
+               return_NULL;
+
        if (!(rh = dm_zalloc(sizeof(*rh)))) {
                log_error("dm_report_init: dm_malloc failed");
-               return 0;
+               return NULL;
        }
 
-       if (_contains_reserved_report_type(types))
-               return_0;
-
        /*
         * rh->report_types is updated in _parse_fields() and _parse_keys()
         * to contain all types corresponding to the fields specified by
@@ -1432,7 +1432,7 @@ int dm_report_object(struct dm_report *rh, void *object)
 
        if (!rh) {
                log_error(INTERNAL_ERROR "dm_report handler is NULL.");
-               goto out;
+               return 0;
        }
 
        if (rh->flags & RH_ALREADY_REPORTED)
@@ -1440,7 +1440,7 @@ int dm_report_object(struct dm_report *rh, void *object)
 
        if (!(row = dm_pool_zalloc(rh->mem, sizeof(*row)))) {
                log_error("dm_report_object: struct row allocation failed");
-               goto out;
+               return 0;
        }
 
        row->rh = rh;
This page took 0.057849 seconds and 5 git commands to generate.