1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

coverity: fix missing initialization

... Using uninitialized value "lockd_state" when calling "lockd_vg"
(even though lockd_vg assigns 0 to the lockd_state, but it looks at
previous state of lockd_state just before that so we need to have
that properly initialized!)

libdm/libdm-report.c:2934: uninit_use_in_call: Using uninitialized value "tm". Field "tm.tm_gmtoff" is uninitialized when calling "_get_final_time".

daemons/lvmlockd/lvmlockctl.c:273: uninit_use_in_call: Using uninitialized element of array "r_name" when calling "format_info_r_action". (just added FIXME as this looks unfinished?)
This commit is contained in:
Peter Rajnoha 2015-07-08 14:53:23 +02:00
parent e8dbaf62d3
commit 3ec4813ba2
11 changed files with 15 additions and 14 deletions

View File

@ -270,6 +270,7 @@ static void format_info_line(char *line)
} else if (!strncmp(line, "info=r_action ", strlen("info=r_action "))) {
/* will use info from previous r */
/* FIXME: r_name and r_type uninitialized here??? */
format_info_r_action(line, r_name, r_type);
} else {
printf("UN %s\n", line);

View File

@ -2911,7 +2911,7 @@ static void _get_final_time(time_range_t range, struct tm *tm,
static int _parse_formatted_date_time(char *str, struct time_value *tval)
{
time_range_t range = RANGE_NONE;
struct tm tm;
struct tm tm = {0};
int gmt_offset;
int tz_supplied;

View File

@ -3314,7 +3314,7 @@ static int lvconvert_single(struct cmd_context *cmd, struct lvconvert_params *lp
struct volume_group *vg;
int ret = ECMD_FAILED;
int saved_ignore_suspended_devices = ignore_suspended_devices();
uint32_t lockd_state;
uint32_t lockd_state = 0;
if (arg_count(cmd, repair_ARG)) {
init_ignore_suspended_devices(1);

View File

@ -1453,7 +1453,7 @@ int lvcreate(struct cmd_context *cmd, int argc, char **argv)
};
struct lvcreate_cmdline_params lcp = { 0 };
struct volume_group *vg;
uint32_t lockd_state;
uint32_t lockd_state = 0;
if (!_lvcreate_params(cmd, argc, argv, &lp, &lcp)) {
stack;

View File

@ -27,7 +27,7 @@ int lvrename(struct cmd_context *cmd, int argc, char **argv)
char *st;
struct volume_group *vg;
struct lv_list *lvl;
uint32_t lockd_state;
uint32_t lockd_state = 0;
int r = ECMD_FAILED;
if (argc == 3) {

View File

@ -169,7 +169,7 @@ int lvresize(struct cmd_context *cmd, int argc, char **argv)
struct volume_group *vg;
struct dm_list *pvh = NULL;
struct logical_volume *lv;
uint32_t lockd_state;
uint32_t lockd_state = 0;
int r = ECMD_FAILED;
if (!_lvresize_params(cmd, argc, argv, &lp))

View File

@ -139,7 +139,7 @@ int wait_for_single_lv(struct cmd_context *cmd, struct poll_operation_id *id,
struct volume_group *vg;
struct logical_volume *lv;
int finished = 0;
uint32_t lockd_state;
uint32_t lockd_state = 0;
/* Poll for completion */
while (!finished) {
@ -369,7 +369,7 @@ static int report_progress(struct cmd_context *cmd, struct poll_operation_id *id
{
struct volume_group *vg;
struct logical_volume *lv;
uint32_t lockd_state;
uint32_t lockd_state = 0;
int ret;
/*

View File

@ -600,7 +600,7 @@ static int _set_up_pvmove(struct cmd_context *cmd, const char *pv_name,
struct dm_list *lvs_changed;
struct physical_volume *pv;
struct logical_volume *lv_mirr;
uint32_t lockd_state;
uint32_t lockd_state = 0;
unsigned flags = PVMOVE_FIRST_TIME;
unsigned exclusive;
int r = ECMD_FAILED;
@ -726,7 +726,7 @@ static int _read_poll_id_from_pvname(struct cmd_context *cmd, const char *pv_nam
struct logical_volume *lv;
struct physical_volume *pv;
struct volume_group *vg;
uint32_t lockd_state;
uint32_t lockd_state = 0;
if (!pv_name) {
log_error(INTERNAL_ERROR "Invalid PV name parameter.");

View File

@ -1889,7 +1889,7 @@ static int _process_vgnameid_list(struct cmd_context *cmd, uint32_t flags,
struct vgnameid_list *vgnl;
const char *vg_name;
const char *vg_uuid;
uint32_t lockd_state;
uint32_t lockd_state = 0;
int selected;
int whole_selected = 0;
int ret_max = ECMD_PROCESSED;
@ -2341,7 +2341,7 @@ static int _process_lv_vgnameid_list(struct cmd_context *cmd, uint32_t flags,
struct dm_str_list *sl;
struct dm_list *tags_arg;
struct dm_list lvnames;
uint32_t lockd_state;
uint32_t lockd_state = 0;
const char *vg_name;
const char *vg_uuid;
const char *vgn;
@ -2873,7 +2873,7 @@ static int _process_pvs_in_vgs(struct cmd_context *cmd, uint32_t flags,
struct vgnameid_list *vgnl;
const char *vg_name;
const char *vg_uuid;
uint32_t lockd_state;
uint32_t lockd_state = 0;
int ret_max = ECMD_PROCESSED;
int ret;
int skip;

View File

@ -141,7 +141,7 @@ int vgreduce(struct cmd_context *cmd, int argc, char **argv)
{
struct volume_group *vg;
const char *vg_name;
uint32_t lockd_state;
uint32_t lockd_state = 0;
int ret = ECMD_FAILED;
int fixed = 1;
int repairing = arg_count(cmd, removemissing_ARG);

View File

@ -68,7 +68,7 @@ static int vg_rename_path(struct cmd_context *cmd, const char *old_vg_path,
const char *vgid = NULL, *vg_name, *vg_name_old;
char old_path[NAME_LEN], new_path[NAME_LEN];
struct volume_group *vg = NULL;
uint32_t lockd_state;
uint32_t lockd_state = 0;
int lock_vg_old_first = 1;
vg_name_old = skip_dev_dir(cmd, old_vg_path, NULL);