various: fix 'uninitialized when used' warnings [clang]
This change fixes "warning: variable 'var' may be uninitialized when used here [-Wconditional-uninitialized]" warnings reported in various files. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
parent
d135e1a1e3
commit
4813a5210f
|
@ -685,7 +685,7 @@ static int find_super_magic(const struct fs_control *ctl)
|
|||
|
||||
static void determine_device_blocks(struct fs_control *ctl, const struct stat *statbuf)
|
||||
{
|
||||
unsigned long long dev_blocks;
|
||||
unsigned long long dev_blocks = 0;
|
||||
|
||||
if (S_ISBLK(statbuf->st_mode)) {
|
||||
int sectorsize;
|
||||
|
|
|
@ -1724,7 +1724,7 @@ static int command_fdisk(struct sfdisk *sf, int argc, char **argv)
|
|||
|
||||
nparts = fdisk_table_get_nents(tb);
|
||||
if (nparts) {
|
||||
size_t cur_partno;
|
||||
size_t cur_partno = (size_t) -1;
|
||||
struct fdisk_partition *pa = fdisk_table_get_partition(tb, nparts - 1);
|
||||
|
||||
assert(pa);
|
||||
|
|
|
@ -55,7 +55,7 @@ static int parse_dos_extended(blkid_probe pr, blkid_parttable tab,
|
|||
|
||||
while (1) {
|
||||
struct dos_partition *p, *p0;
|
||||
uint32_t start, size;
|
||||
uint32_t start = 0, size;
|
||||
|
||||
if (++ct_nodata > 100)
|
||||
return BLKID_PROBE_OK;
|
||||
|
|
|
@ -1010,7 +1010,7 @@ blkid_partition blkid_partlist_get_partition_by_partno(blkid_partlist ls, int n)
|
|||
blkid_partition blkid_partlist_devno_to_partition(blkid_partlist ls, dev_t devno)
|
||||
{
|
||||
struct path_cxt *pc;
|
||||
uint64_t start, size;
|
||||
uint64_t start = 0, size;
|
||||
int i, rc, partno = 0;
|
||||
|
||||
DBG(LOWPROBE, ul_debug("trying to convert devno 0x%llx to partition",
|
||||
|
|
|
@ -78,7 +78,7 @@ static int probe_ddf(blkid_probe pr,
|
|||
size_t i;
|
||||
struct ddf_header *ddf = NULL;
|
||||
char version[DDF_REV_LENGTH + 1];
|
||||
uint64_t off, lba;
|
||||
uint64_t off = 0, lba;
|
||||
|
||||
if (pr->size < 0x30000)
|
||||
return 1;
|
||||
|
|
|
@ -191,7 +191,7 @@ static int probe_hfsplus(blkid_probe pr, const struct blkid_idmag *mag)
|
|||
unsigned int off = 0;
|
||||
unsigned int blocksize;
|
||||
unsigned int cat_block;
|
||||
unsigned int ext_block_start;
|
||||
unsigned int ext_block_start = 0;
|
||||
unsigned int ext_block_count;
|
||||
unsigned int record_count;
|
||||
unsigned int leaf_node_head;
|
||||
|
|
|
@ -218,7 +218,7 @@ static int probe_zfs(blkid_probe pr,
|
|||
const struct blkid_idmag *mag __attribute__((__unused__)))
|
||||
{
|
||||
int swab_endian = 0;
|
||||
struct zfs_uberblock *ub;
|
||||
struct zfs_uberblock *ub = NULL;
|
||||
loff_t offset = 0, ub_offset = 0;
|
||||
int label_no, found = 0, found_in_label;
|
||||
void *label;
|
||||
|
|
|
@ -1708,7 +1708,7 @@ static int dos_add_partition(struct fdisk_context *cxt,
|
|||
} else {
|
||||
char hint[BUFSIZ];
|
||||
struct fdisk_ask *ask;
|
||||
int c;
|
||||
int c = 0;
|
||||
|
||||
/* the default layout for scripts is to create primary partitions */
|
||||
if (cxt->script || !fdisk_has_dialogs(cxt)) {
|
||||
|
|
|
@ -728,7 +728,7 @@ int fdisk_diff_tables(struct fdisk_table *a, struct fdisk_table *b,
|
|||
struct fdisk_iter *itr,
|
||||
struct fdisk_partition **res, int *change)
|
||||
{
|
||||
struct fdisk_partition *pa, *pb;
|
||||
struct fdisk_partition *pa = NULL, *pb;
|
||||
int rc = 1;
|
||||
|
||||
assert(itr);
|
||||
|
|
|
@ -237,7 +237,7 @@ static int pencode(char *s)
|
|||
|
||||
static int unix_socket(struct logger_ctl *ctl, const char *path, int *socket_type)
|
||||
{
|
||||
int fd, i, type = -1;
|
||||
int fd = -1, i, type = -1;
|
||||
static struct sockaddr_un s_addr; /* AF_UNIX address of local logger */
|
||||
|
||||
if (strlen(path) >= sizeof(s_addr.sun_path))
|
||||
|
|
|
@ -313,7 +313,8 @@ static void server_loop(const char *socket_path, const char *pidfile_path,
|
|||
uuid_t uu;
|
||||
char reply_buf[1024], *cp;
|
||||
char op, str[UUID_STR_LEN];
|
||||
int i, ns, len, num;
|
||||
int i, ns, len;
|
||||
int num; /* intentionally uninitialized */
|
||||
int s = 0;
|
||||
int fd_pidfile = -1;
|
||||
int ret;
|
||||
|
|
|
@ -144,7 +144,7 @@ static void fill_table_row(struct libscols_table *tb, char const *const uuid)
|
|||
size_t i;
|
||||
uuid_t buf;
|
||||
int invalid = 0;
|
||||
int variant, type;
|
||||
int variant = -1, type = -1;
|
||||
|
||||
assert(tb);
|
||||
assert(uuid);
|
||||
|
|
|
@ -954,7 +954,7 @@ manipulate_clock(const struct hwclock_control *ctl, const time_t set_time,
|
|||
const struct timeval startup_time, struct adjtime *adjtime)
|
||||
{
|
||||
/* The time at which we read the Hardware Clock */
|
||||
struct timeval read_time;
|
||||
struct timeval read_time = { 0 };
|
||||
/*
|
||||
* The Hardware Clock gives us a valid time, or at
|
||||
* least something close enough to fool mktime().
|
||||
|
|
|
@ -136,7 +136,7 @@ int main(int argc, char **argv)
|
|||
unsigned long long add0 = 0;
|
||||
unsigned int step;
|
||||
unsigned int *buf, total, fn_len;
|
||||
unsigned long long fn_add, next_add; /* current and next address */
|
||||
unsigned long long fn_add = 0, next_add; /* current and next address */
|
||||
char fn_name[S_LEN], next_name[S_LEN]; /* current and next name */
|
||||
char mode[8];
|
||||
int c;
|
||||
|
|
|
@ -266,7 +266,7 @@ int main(int argc, char *argv[])
|
|||
int verbose = 0;
|
||||
int archwrapper;
|
||||
int c;
|
||||
struct arch_domain *doms, *target;
|
||||
struct arch_domain *doms, *target = NULL;
|
||||
unsigned long pers_value = 0;
|
||||
char *shell = NULL, *shell_arg = NULL;
|
||||
|
||||
|
|
Loading…
Reference in New Issue