Commit 831115af5ca36d713355bf1b379081691eca8b3f
1 parent
332b122d39
Exists in
ti-lsk-linux-4.1.y
and in
10 other branches
eCryptfs: Remove unnecessary casts when parsing packet lengths
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>
Showing 1 changed file with 3 additions and 3 deletions Side-by-side Diff
fs/ecryptfs/keystore.c
... | ... | @@ -100,12 +100,12 @@ |
100 | 100 | (*size) = 0; |
101 | 101 | if (data[0] < 192) { |
102 | 102 | /* One-byte length */ |
103 | - (*size) = (unsigned char)data[0]; | |
103 | + (*size) = data[0]; | |
104 | 104 | (*length_size) = 1; |
105 | 105 | } else if (data[0] < 224) { |
106 | 106 | /* Two-byte length */ |
107 | - (*size) = (((unsigned char)(data[0]) - 192) * 256); | |
108 | - (*size) += ((unsigned char)(data[1]) + 192); | |
107 | + (*size) = (data[0] - 192) * 256; | |
108 | + (*size) += data[1] + 192; | |
109 | 109 | (*length_size) = 2; |
110 | 110 | } else if (data[0] == 255) { |
111 | 111 | /* If support is added, adjust ECRYPTFS_MAX_PKT_LEN_SIZE */ |