Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix real problems indicated by warnings
- Fix few uninitialized variables
- Fix pointer not dereferenced

And two false positives:

- Use constant format string with syslog to fix fedora errors when built
  with `-Werror=format-security` - false positive.
  • Loading branch information
csonto committed Aug 25, 2017
1 parent b981daf commit 4e8349f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions lib/events/libdmraid-events-isw.c
Expand Up @@ -838,13 +838,13 @@ static void _log_either(enum log_type log_type,

sz = _log_all_devs(log_type, rs, NULL, 0);
if (!sz) {
syslog(LOG_ERR, msg[0]);
syslog(LOG_ERR, "%s", msg[0]);
return;
}

str = dm_malloc(++sz);
if (!str) {
syslog(LOG_ERR, msg[1]);
syslog(LOG_ERR, "%s", msg[1]);
return;
}

Expand Down Expand Up @@ -1076,7 +1076,7 @@ static enum disk_state_type _process_stripe_event(struct dm_task *dmt,
char *params)
{
int argc, i, num_devs, ret = D_INSYNC;
char **args, *dev_status_str, *p;
char **args = NULL, *dev_status_str, *p;
const char *rs_name = dm_task_get_name(dmt);
struct dso_raid_set *rs = _find_raid_set(rs_name, NULL, 1);
struct dso_raid_dev *dev;
Expand Down
4 changes: 2 additions & 2 deletions lib/format/ataraid/jm.c
Expand Up @@ -32,10 +32,10 @@ name(struct lib_context *lc, struct raid_dev *rd, unsigned int subset)

/* Sanitize name, make sure it's null terminated */
strncpy(buf, name, JM_NAME_LEN);
while (i && isspace(buf[i])) {
i = strlen(buf);
while (i-- && isspace(buf[i])) {
name[i]='\0';
buf[i]='\0';
--i;
}

len = strlen(buf) + sizeof(HANDLER) + (jm->mode == JM_T_RAID01 ? 3 : 2);
Expand Down
2 changes: 1 addition & 1 deletion lib/metadata/metadata.c
Expand Up @@ -1433,7 +1433,7 @@ create_raidset(struct lib_context *lc, struct raid_set_descr *rsd)
rd->sectors = 0;
list_add_tail(&rd->devs, &rs->devs);
n++;
} while (end++ != '\0');
} while (*end++ != '\0');

rs->total_devs = rs->found_devs = n;
rs_tmp = rs;
Expand Down

0 comments on commit 4e8349f

Please sign in to comment.