Fix some compiler warnings.

This commit is contained in:
Milan Broz
2017-04-05 14:24:20 +02:00
parent e4f1faa478
commit 82dd6c7fa2
3 changed files with 9 additions and 8 deletions

View File

@@ -96,7 +96,7 @@ static int FEC_read_interleaved(struct fec_context *ctx, uint64_t i,
if (lseek(ctx->inputs[n].fd, ctx->inputs[n].start + offset, SEEK_SET) < 0)
return -1;
return (read_buffer(ctx->inputs[n].fd, output, count) == count) ? 0 : -1;
return (read_buffer(ctx->inputs[n].fd, output, count) == (ssize_t)count) ? 0 : -1;
}
/* should never be reached */
@@ -163,7 +163,7 @@ static int FEC_encode_inputs(struct crypt_device *cd,
rs_block[i] = buf[i * ctx.block_size + b];
encode_rs_char(rs, rs_block, parity);
if (write_buffer(fd, parity, sizeof(parity)) != sizeof(parity)) {
if (write_buffer(fd, parity, sizeof(parity)) != (ssize_t)sizeof(parity)) {
log_err(cd, _("Failed to write parity for RS block %" PRIu64 ".\n"), n);
r = -EIO;
goto out;

View File

@@ -14,6 +14,7 @@ lib/loopaes/loopaes.c
lib/tcrypt/tcrypt.c
lib/verity/verity.c
lib/verity/verity_hash.c
lib/verity/verity_fec.c
src/cryptsetup.c
src/veritysetup.c
src/cryptsetup_reencrypt.c

View File

@@ -255,7 +255,7 @@ static int tcrypt_load(struct crypt_device *cd, struct crypt_params_tcrypt *para
char *tmp_pim_nptr = NULL;
char *tmp_pim_end = NULL;
size_t tmp_pim_size = 0;
unsigned long int tmp_pim_ul = 0;
unsigned long long tmp_pim_ull = 0;
r = tools_get_key(_("Enter VeraCrypt PIM: "),
CONST_CAST(char**)&tmp_pim_nptr,
@@ -264,14 +264,14 @@ static int tcrypt_load(struct crypt_device *cd, struct crypt_params_tcrypt *para
if (r < 0)
continue;
tmp_pim_ul = strtoul(tmp_pim_nptr, &tmp_pim_end, 10);
tmp_pim_ull = strtoull(tmp_pim_nptr, &tmp_pim_end, 10);
if (*tmp_pim_nptr == '\0' || !tmp_pim_end || *tmp_pim_end != '\0') {
log_err(_("Invalid PIM value: parse error\n"));
r = -EINVAL;
} else if (tmp_pim_ul == 0) {
} else if (tmp_pim_ull == 0) {
log_err(_("Invalid PIM value: 0\n"));
r = -EINVAL;
} else if (tmp_pim_ul > ((1L << (CHAR_BIT * sizeof(params->veracrypt_pim))) - 1)) {
} else if (tmp_pim_ull > UINT32_MAX) {
log_err(_("Invalid PIM value: outside of range\n"));
r = -ERANGE;
}
@@ -279,8 +279,8 @@ static int tcrypt_load(struct crypt_device *cd, struct crypt_params_tcrypt *para
if (r < 0)
continue;
params->veracrypt_pim = tmp_pim_ul;
crypt_memzero(&tmp_pim_ul, sizeof(tmp_pim_ul));
params->veracrypt_pim = (uint32_t)tmp_pim_ull;
crypt_memzero(&tmp_pim_ull, sizeof(tmp_pim_ull));
}
if (opt_tcrypt_hidden)