mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-17 22:00:07 +01:00
Fix all format string issues found by the attribute format patch
This commit is contained in:
committed by
Milan Broz
parent
ae23ecb9b2
commit
a809224ec7
@@ -137,7 +137,7 @@ int LOOPAES_parse_keyfile(struct crypt_device *cd,
|
|||||||
unsigned int key_lengths[LOOPAES_KEYS_MAX];
|
unsigned int key_lengths[LOOPAES_KEYS_MAX];
|
||||||
unsigned int i, key_index, key_len, offset;
|
unsigned int i, key_index, key_len, offset;
|
||||||
|
|
||||||
log_dbg("Parsing loop-AES keyfile of size %d.", buffer_len);
|
log_dbg("Parsing loop-AES keyfile of size %zu.", buffer_len);
|
||||||
|
|
||||||
if (!buffer_len)
|
if (!buffer_len)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ static int LUKS_check_device_size(struct crypt_device *ctx, size_t keyLength)
|
|||||||
|
|
||||||
dev_sectors >>= SECTOR_SHIFT;
|
dev_sectors >>= SECTOR_SHIFT;
|
||||||
hdr_sectors = LUKS_device_sectors(keyLength);
|
hdr_sectors = LUKS_device_sectors(keyLength);
|
||||||
log_dbg("Key length %u, device size %" PRIu64 " sectors, header size %"
|
log_dbg("Key length %zu, device size %" PRIu64 " sectors, header size %"
|
||||||
PRIu64 " sectors.",keyLength, dev_sectors, hdr_sectors);
|
PRIu64 " sectors.",keyLength, dev_sectors, hdr_sectors);
|
||||||
|
|
||||||
if (hdr_sectors > dev_sectors) {
|
if (hdr_sectors > dev_sectors) {
|
||||||
@@ -171,10 +171,10 @@ int LUKS_hdr_backup(
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
log_dbg("Storing backup of header (%u bytes) and keyslot area (%u bytes).",
|
log_dbg("Storing backup of header (%zu bytes) and keyslot area (%zu bytes).",
|
||||||
sizeof(*hdr), hdr_size - LUKS_ALIGN_KEYSLOTS);
|
sizeof(*hdr), hdr_size - LUKS_ALIGN_KEYSLOTS);
|
||||||
|
|
||||||
log_dbg("Output backup file size: %u bytes.", buffer_size);
|
log_dbg("Output backup file size: %zu bytes.", buffer_size);
|
||||||
|
|
||||||
devfd = device_open(device, O_RDONLY);
|
devfd = device_open(device, O_RDONLY);
|
||||||
if(devfd == -1) {
|
if(devfd == -1) {
|
||||||
@@ -287,7 +287,7 @@ int LUKS_hdr_restore(
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
log_dbg("Storing backup of header (%u bytes) and keyslot area (%u bytes) to device %s.",
|
log_dbg("Storing backup of header (%zu bytes) and keyslot area (%zu bytes) to device %s.",
|
||||||
sizeof(*hdr), buffer_size - LUKS_ALIGN_KEYSLOTS, device_path(device));
|
sizeof(*hdr), buffer_size - LUKS_ALIGN_KEYSLOTS, device_path(device));
|
||||||
|
|
||||||
devfd = device_open(device, O_RDWR);
|
devfd = device_open(device, O_RDWR);
|
||||||
@@ -520,7 +520,7 @@ int LUKS_read_phdr(struct luks_phdr *hdr,
|
|||||||
if (repair && !require_luks_device)
|
if (repair && !require_luks_device)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
log_dbg("Reading LUKS header of size %d from device %s",
|
log_dbg("Reading LUKS header of size %zu from device %s",
|
||||||
hdr_size, device_path(device));
|
hdr_size, device_path(device));
|
||||||
|
|
||||||
devfd = device_open(device, O_RDONLY);
|
devfd = device_open(device, O_RDONLY);
|
||||||
@@ -552,7 +552,7 @@ int LUKS_write_phdr(struct luks_phdr *hdr,
|
|||||||
struct luks_phdr convHdr;
|
struct luks_phdr convHdr;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
log_dbg("Updating LUKS header of size %d on device %s",
|
log_dbg("Updating LUKS header of size %lu on device %s",
|
||||||
sizeof(struct luks_phdr), device_path(device));
|
sizeof(struct luks_phdr), device_path(device));
|
||||||
|
|
||||||
r = LUKS_check_device_size(ctx, hdr->keyBytes);
|
r = LUKS_check_device_size(ctx, hdr->keyBytes);
|
||||||
|
|||||||
@@ -558,7 +558,7 @@ static int TCRYPT_init_hdr(struct crypt_device *cd,
|
|||||||
", volume size %" PRIu64, (int)hdr->d.version,
|
", volume size %" PRIu64, (int)hdr->d.version,
|
||||||
(int)hdr->d.version_tc, (int)hdr->d.sector_size,
|
(int)hdr->d.version_tc, (int)hdr->d.sector_size,
|
||||||
hdr->d.mk_offset, hdr->d.hidden_volume_size, hdr->d.volume_size);
|
hdr->d.mk_offset, hdr->d.hidden_volume_size, hdr->d.volume_size);
|
||||||
log_dbg("TCRYPT: Header cipher %s-%s, key size %d",
|
log_dbg("TCRYPT: Header cipher %s-%s, key size %zu",
|
||||||
params->cipher, params->mode, params->key_size);
|
params->cipher, params->mode, params->key_size);
|
||||||
}
|
}
|
||||||
out:
|
out:
|
||||||
@@ -580,7 +580,7 @@ int TCRYPT_read_phdr(struct crypt_device *cd,
|
|||||||
|
|
||||||
assert(sizeof(struct tcrypt_phdr) == 512);
|
assert(sizeof(struct tcrypt_phdr) == 512);
|
||||||
|
|
||||||
log_dbg("Reading TCRYPT header of size %d bytes from device %s.",
|
log_dbg("Reading TCRYPT header of size %zu bytes from device %s.",
|
||||||
hdr_size, device_path(device));
|
hdr_size, device_path(device));
|
||||||
|
|
||||||
bs = device_block_size(device);
|
bs = device_block_size(device);
|
||||||
@@ -1038,6 +1038,6 @@ int TCRYPT_dump(struct crypt_device *cd,
|
|||||||
}
|
}
|
||||||
log_std(cd, "Cipher chain:\t%s\n", params->cipher);
|
log_std(cd, "Cipher chain:\t%s\n", params->cipher);
|
||||||
log_std(cd, "Cipher mode:\t%s\n", params->mode);
|
log_std(cd, "Cipher mode:\t%s\n", params->mode);
|
||||||
log_std(cd, "MK bits: \t%d\n", params->key_size * 8);
|
log_std(cd, "MK bits: \t%zu\n", params->key_size * 8);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,11 +63,11 @@ int VERITY_read_sb(struct crypt_device *cd,
|
|||||||
ssize_t hdr_size = sizeof(struct verity_sb);
|
ssize_t hdr_size = sizeof(struct verity_sb);
|
||||||
int devfd = 0, sb_version;
|
int devfd = 0, sb_version;
|
||||||
|
|
||||||
log_dbg("Reading VERITY header of size %u on device %s, offset %" PRIu64 ".",
|
log_dbg("Reading VERITY header of size %lu on device %s, offset %" PRIu64 ".",
|
||||||
sizeof(struct verity_sb), device_path(device), sb_offset);
|
sizeof(struct verity_sb), device_path(device), sb_offset);
|
||||||
|
|
||||||
if (params->flags & CRYPT_VERITY_NO_HEADER) {
|
if (params->flags & CRYPT_VERITY_NO_HEADER) {
|
||||||
log_err(cd, _("Verity device doesn't use on-disk header.\n"),
|
log_err(cd, _("Verity device %s doesn't use on-disk header.\n"),
|
||||||
device_path(device));
|
device_path(device));
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
@@ -159,17 +159,17 @@ int VERITY_write_sb(struct crypt_device *cd,
|
|||||||
uuid_t uuid;
|
uuid_t uuid;
|
||||||
int r, devfd = 0;
|
int r, devfd = 0;
|
||||||
|
|
||||||
log_dbg("Updating VERITY header of size %u on device %s, offset %" PRIu64 ".",
|
log_dbg("Updating VERITY header of size %lu on device %s, offset %" PRIu64 ".",
|
||||||
sizeof(struct verity_sb), device_path(device), sb_offset);
|
sizeof(struct verity_sb), device_path(device), sb_offset);
|
||||||
|
|
||||||
if (!uuid_string || uuid_parse(uuid_string, uuid) == -1) {
|
if (!uuid_string || uuid_parse(uuid_string, uuid) == -1) {
|
||||||
log_err(cd, _("Wrong VERITY UUID format provided.\n"),
|
log_err(cd, _("Wrong VERITY UUID format provided on device %s. \n"),
|
||||||
device_path(device));
|
device_path(device));
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (params->flags & CRYPT_VERITY_NO_HEADER) {
|
if (params->flags & CRYPT_VERITY_NO_HEADER) {
|
||||||
log_err(cd, _("Verity device doesn't use on-disk header.\n"),
|
log_err(cd, _("Verity device %s doesn't use on-disk header.\n"),
|
||||||
device_path(device));
|
device_path(device));
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -571,10 +571,10 @@ static int action_benchmark(void)
|
|||||||
snprintf(cipher, MAX_CIPHER_LEN, "%s-%s",
|
snprintf(cipher, MAX_CIPHER_LEN, "%s-%s",
|
||||||
bciphers[i].cipher, bciphers[i].mode);
|
bciphers[i].cipher, bciphers[i].mode);
|
||||||
if (!r)
|
if (!r)
|
||||||
log_std("%12s %4db %6.1f MiB/s %6.1f MiB/s\n",
|
log_std("%12s %4zub %6.1f MiB/s %6.1f MiB/s\n",
|
||||||
cipher, bciphers[i].key_size*8, enc_mbr, dec_mbr);
|
cipher, bciphers[i].key_size*8, enc_mbr, dec_mbr);
|
||||||
else
|
else
|
||||||
log_std("%12s %4db %13s %13s\n", cipher,
|
log_std("%12s %4zub %13s %13s\n", cipher,
|
||||||
bciphers[i].key_size*8, _("N/A"), _("N/A"));
|
bciphers[i].key_size*8, _("N/A"), _("N/A"));
|
||||||
}
|
}
|
||||||
if (skipped && skipped == i)
|
if (skipped && skipped == i)
|
||||||
|
|||||||
Reference in New Issue
Block a user