crypto: img-hash - Fix hash request context
authorWill Thomas <will.thomas@imgtec.com>
Fri, 5 Aug 2016 13:00:15 +0000 (14:00 +0100)
committerHerbert Xu <herbert@gondor.apana.org.au>
Tue, 9 Aug 2016 10:47:20 +0000 (18:47 +0800)
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>
drivers/crypto/img-hash.c

index e5c941bdc6933125bd841f73a79e048910f8fd6c..de2b86efbfe44c996c29048b8e8a26070c4b543a 100644 (file)
@@ -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 {