mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-15 04:40:05 +01:00
Fix some compiler warnings.
This commit is contained in:
@@ -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)
|
if (lseek(ctx->inputs[n].fd, ctx->inputs[n].start + offset, SEEK_SET) < 0)
|
||||||
return -1;
|
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 */
|
/* 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];
|
rs_block[i] = buf[i * ctx.block_size + b];
|
||||||
|
|
||||||
encode_rs_char(rs, rs_block, parity);
|
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);
|
log_err(cd, _("Failed to write parity for RS block %" PRIu64 ".\n"), n);
|
||||||
r = -EIO;
|
r = -EIO;
|
||||||
goto out;
|
goto out;
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ lib/loopaes/loopaes.c
|
|||||||
lib/tcrypt/tcrypt.c
|
lib/tcrypt/tcrypt.c
|
||||||
lib/verity/verity.c
|
lib/verity/verity.c
|
||||||
lib/verity/verity_hash.c
|
lib/verity/verity_hash.c
|
||||||
|
lib/verity/verity_fec.c
|
||||||
src/cryptsetup.c
|
src/cryptsetup.c
|
||||||
src/veritysetup.c
|
src/veritysetup.c
|
||||||
src/cryptsetup_reencrypt.c
|
src/cryptsetup_reencrypt.c
|
||||||
|
|||||||
@@ -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_nptr = NULL;
|
||||||
char *tmp_pim_end = NULL;
|
char *tmp_pim_end = NULL;
|
||||||
size_t tmp_pim_size = 0;
|
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: "),
|
r = tools_get_key(_("Enter VeraCrypt PIM: "),
|
||||||
CONST_CAST(char**)&tmp_pim_nptr,
|
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)
|
if (r < 0)
|
||||||
continue;
|
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') {
|
if (*tmp_pim_nptr == '\0' || !tmp_pim_end || *tmp_pim_end != '\0') {
|
||||||
log_err(_("Invalid PIM value: parse error\n"));
|
log_err(_("Invalid PIM value: parse error\n"));
|
||||||
r = -EINVAL;
|
r = -EINVAL;
|
||||||
} else if (tmp_pim_ul == 0) {
|
} else if (tmp_pim_ull == 0) {
|
||||||
log_err(_("Invalid PIM value: 0\n"));
|
log_err(_("Invalid PIM value: 0\n"));
|
||||||
r = -EINVAL;
|
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"));
|
log_err(_("Invalid PIM value: outside of range\n"));
|
||||||
r = -ERANGE;
|
r = -ERANGE;
|
||||||
}
|
}
|
||||||
@@ -279,8 +279,8 @@ static int tcrypt_load(struct crypt_device *cd, struct crypt_params_tcrypt *para
|
|||||||
if (r < 0)
|
if (r < 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
params->veracrypt_pim = tmp_pim_ul;
|
params->veracrypt_pim = (uint32_t)tmp_pim_ull;
|
||||||
crypt_memzero(&tmp_pim_ul, sizeof(tmp_pim_ul));
|
crypt_memzero(&tmp_pim_ull, sizeof(tmp_pim_ull));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opt_tcrypt_hidden)
|
if (opt_tcrypt_hidden)
|
||||||
|
|||||||
Reference in New Issue
Block a user