Skip to content

Commit

Permalink
dm crypt: fix get_key_size compiler warning if !CONFIG_KEYS
Browse files Browse the repository at this point in the history
Explicitly convert unsigned int in the right of the conditional
expression to int to match the left side operand and the return type,
fixing the following compiler warning:

drivers/md/dm-crypt.c:2593:43: warning: signed and unsigned
type in conditional expression [-Wsign-compare]

Fixes: c538f6e ("dm crypt: add ability to use keys from the kernel key retention service")
Signed-off-by: Aashish Sharma <shraash@google.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
  • Loading branch information
Aashish Sharma authored and Mike Snitzer committed Feb 22, 2022
1 parent 588b7f5 commit 6fc5150
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/md/dm-crypt.c
Original file line number Diff line number Diff line change
Expand Up @@ -2582,7 +2582,7 @@ static int crypt_set_keyring_key(struct crypt_config *cc, const char *key_string

static int get_key_size(char **key_string)
{
return (*key_string[0] == ':') ? -EINVAL : strlen(*key_string) >> 1;
return (*key_string[0] == ':') ? -EINVAL : (int)(strlen(*key_string) >> 1);
}

#endif /* CONFIG_KEYS */
Expand Down

0 comments on commit 6fc5150

Please sign in to comment.