Skip to content

Commit

Permalink
eCryptfs: Remove unnecessary casts when parsing packet lengths
Browse files Browse the repository at this point in the history
The elements in the data array are already unsigned chars and do not
need to be casted.

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
  • Loading branch information
Tyler Hicks committed Oct 29, 2014
1 parent 332b122 commit 831115a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions fs/ecryptfs/keystore.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,12 @@ int ecryptfs_parse_packet_length(unsigned char *data, size_t *size,
(*size) = 0;
if (data[0] < 192) {
/* One-byte length */
(*size) = (unsigned char)data[0];
(*size) = data[0];
(*length_size) = 1;
} else if (data[0] < 224) {
/* Two-byte length */
(*size) = (((unsigned char)(data[0]) - 192) * 256);
(*size) += ((unsigned char)(data[1]) + 192);
(*size) = (data[0] - 192) * 256;
(*size) += data[1] + 192;
(*length_size) = 2;
} else if (data[0] == 255) {
/* If support is added, adjust ECRYPTFS_MAX_PKT_LEN_SIZE */
Expand Down

0 comments on commit 831115a

Please sign in to comment.