diff options
author | Milan Broz <gmazyland@gmail.com> | 2015-09-08 08:12:07 +0200 |
---|---|---|
committer | Milan Broz <gmazyland@gmail.com> | 2015-09-08 08:12:07 +0200 |
commit | 7d9a14fd249457cfdf4c20f6d68eb152f5a0515b (patch) | |
tree | 6dba506668a3e9968328cd88ae4a129efc805699 | |
parent | 2f964d95d8165dd08f142c80c06719a0a59a6f28 (diff) | |
download | cryptsetup-7d9a14fd249457cfdf4c20f6d68eb152f5a0515b.tar.gz |
Fix some signed/unsigned compiler warnings.
-rw-r--r-- | src/cryptsetup.c | 14 | ||||
-rw-r--r-- | src/cryptsetup_reencrypt.c | 2 |
2 files changed, 8 insertions, 8 deletions
diff --git a/src/cryptsetup.c b/src/cryptsetup.c index 8847c29..d523dc9 100644 --- a/src/cryptsetup.c +++ b/src/cryptsetup.c @@ -121,7 +121,7 @@ static int action_open_plain(void) .size = opt_size, }; char *password = NULL; - size_t passwordLen; + size_t passwordLen, key_size_max; size_t key_size = (opt_key_size ?: DEFAULT_PLAIN_KEYBITS) / 8; uint32_t activate_flags = 0; int r; @@ -174,17 +174,17 @@ static int action_open_plain(void) * If hash is specified, opt_keyfile_size is applied. * The opt_keyfile_offset is applied always. */ + key_size_max = params.hash ? (size_t)opt_keyfile_size : key_size; r = crypt_activate_by_keyfile_offset(cd, action_argv[1], - CRYPT_ANY_SLOT, opt_key_file, - params.hash ? opt_keyfile_size : key_size, opt_keyfile_offset, - activate_flags); + CRYPT_ANY_SLOT, opt_key_file, key_size_max, + opt_keyfile_offset, activate_flags); } else { + key_size_max = (opt_key_file && !params.hash) ? key_size : (size_t)opt_keyfile_size; r = tools_get_key(_("Enter passphrase: "), &password, &passwordLen, - opt_keyfile_offset, (opt_key_file && !params.hash) ? key_size : opt_keyfile_size, + opt_keyfile_offset, key_size_max, opt_key_file, opt_timeout, - _verify_passphrase(0), 0, - cd); + _verify_passphrase(0), 0, cd); if (r < 0) goto out; diff --git a/src/cryptsetup_reencrypt.c b/src/cryptsetup_reencrypt.c index 2419808..a6e077f 100644 --- a/src/cryptsetup_reencrypt.c +++ b/src/cryptsetup_reencrypt.c @@ -852,7 +852,7 @@ static void zero_rest_of_device(int fd, size_t block_size, void *buf, s1 = block_size; while (!quit && *bytes) { - if (*bytes < s1) + if (*bytes < (uint64_t)s1) s1 = *bytes; s2 = write(fd, buf, s1); |