aboutsummaryrefslogtreecommitdiffstats
path: root/module/zfs/sha256.c
diff options
context:
space:
mode:
authorGvozden Neskovic <[email protected]>2016-09-02 15:07:00 +0200
committerBrian Behlendorf <[email protected]>2016-09-29 15:55:41 -0700
commit4ca9c1de129f8250c446c2355349e6b300d84586 (patch)
treea808616289ca5a6ec68d5bfd9c20a5de870ca03b /module/zfs/sha256.c
parent031d7c2fe6afaa78943bd0a563b91fc84ace42d7 (diff)
Explicit integer promotion for bit shift operations
Explicitly promote variables to correct type. Undefined behavior is reported because length of int is not well defined by C standard. Issue #4883 Signed-off-by: Gvozden Neskovic <[email protected]>
Diffstat (limited to 'module/zfs/sha256.c')
-rw-r--r--module/zfs/sha256.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/module/zfs/sha256.c b/module/zfs/sha256.c
index cf9dd8fcb..57f5b7daf 100644
--- a/module/zfs/sha256.c
+++ b/module/zfs/sha256.c
@@ -76,7 +76,8 @@ SHA256Transform(uint32_t *H, const uint8_t *cp)
uint32_t a, b, c, d, e, f, g, h, t, T1, T2, W[64];
for (t = 0; t < 16; t++, cp += 4)
- W[t] = (cp[0] << 24) | (cp[1] << 16) | (cp[2] << 8) | cp[3];
+ W[t] = ((uint32_t)cp[0] << 24) | ((uint32_t)cp[1] << 16) |
+ ((uint32_t)cp[2] << 8) | (uint32_t)cp[3];
for (t = 16; t < 64; t++)
W[t] = sigma1(W[t - 2]) + W[t - 7] +