summaryrefslogtreecommitdiffstats
path: root/drivers/crypto/img-hash.c
diff options
context:
space:
mode:
authorWill Thomas <will.thomas@imgtec.com>2016-08-05 15:00:15 +0200
committerHerbert Xu <herbert@gondor.apana.org.au>2016-08-09 12:47:20 +0200
commitdd4f677b0c89280e66ab9bebf97c8c90fbc1c330 (patch)
treebd1d9b95ac7c26d0ff3cecb15fe511e4e4957d96 /drivers/crypto/img-hash.c
parentcrypto: img-hash - Fix null pointer exception (diff)
downloadlinux-dd4f677b0c89280e66ab9bebf97c8c90fbc1c330.tar.xz
linux-dd4f677b0c89280e66ab9bebf97c8c90fbc1c330.zip
crypto: img-hash - Fix hash request context
Move 0 length buffer to end of structure to stop overwriting fallback request data. This doesn't cause a bug itself as the buffer is never used alongside the fallback but should be changed. Signed-off-by: Will Thomas <will.thomas@imgtec.com> Reviewed-by: James Hartley <james.hartley@imgtec.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto/img-hash.c')
-rw-r--r--drivers/crypto/img-hash.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/crypto/img-hash.c b/drivers/crypto/img-hash.c
index e5c941bdc693..de2b86efbfe4 100644
--- a/drivers/crypto/img-hash.c
+++ b/drivers/crypto/img-hash.c
@@ -102,8 +102,10 @@ struct img_hash_request_ctx {
unsigned long op;
size_t bufcnt;
- u8 buffer[0] __aligned(sizeof(u32));
struct ahash_request fallback_req;
+
+ /* Zero length buffer must remain last member of struct */
+ u8 buffer[0] __aligned(sizeof(u32));
};
struct img_hash_ctx {