Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

crypto: ixp4xx - Fix false lastlen uninitialised warning

This patch fixes a false positive uninitialised variable warning
in aead_perform by moving the source processing in front of the
destination processing, thus ensuring that the initialisation of
lastlen is always visible to gcc.

Reported-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Acked-by: Arnd Bergmann <arnd@arndb.de>

+12 -14
+12 -14
drivers/crypto/ixp4xx_crypto.c
··· 1031 1031 BUG_ON(ivsize && !req->iv); 1032 1032 memcpy(crypt->iv, req->iv, ivsize); 1033 1033 1034 + buf = chainup_buffers(dev, req->src, crypt->auth_len, 1035 + &src_hook, flags, src_direction); 1036 + req_ctx->src = src_hook.next; 1037 + crypt->src_buf = src_hook.phys_next; 1038 + if (!buf) 1039 + goto free_buf_src; 1040 + 1041 + lastlen = buf->buf_len; 1042 + if (lastlen >= authsize) 1043 + crypt->icv_rev_aes = buf->phys_addr + 1044 + buf->buf_len - authsize; 1045 + 1034 1046 req_ctx->dst = NULL; 1035 1047 1036 1048 if (req->src != req->dst) { ··· 1065 1053 crypt->icv_rev_aes = buf->phys_addr + 1066 1054 buf->buf_len - authsize; 1067 1055 } 1068 - } 1069 - 1070 - buf = chainup_buffers(dev, req->src, crypt->auth_len, 1071 - &src_hook, flags, src_direction); 1072 - req_ctx->src = src_hook.next; 1073 - crypt->src_buf = src_hook.phys_next; 1074 - if (!buf) 1075 - goto free_buf_src; 1076 - 1077 - if (!encrypt || !req_ctx->dst) { 1078 - lastlen = buf->buf_len; 1079 - if (lastlen >= authsize) 1080 - crypt->icv_rev_aes = buf->phys_addr + 1081 - buf->buf_len - authsize; 1082 1056 } 1083 1057 1084 1058 if (unlikely(lastlen < authsize)) {