crypto: ccp - Rearrange structure members to minimize size
authorGary R Hook <gary.hook@amd.com>
Tue, 28 Mar 2017 15:57:26 +0000 (10:57 -0500)
committerHerbert Xu <herbert@gondor.apana.org.au>
Wed, 5 Apr 2017 13:58:35 +0000 (21:58 +0800)
The AES GCM function (in ccp-ops) requires a fair amount of
stack space, which elicits a complaint when KASAN is enabled.
Rearranging and packing a few structures eliminates the
warning.

Signed-off-by: Gary R Hook <gary.hook@amd.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/ccp/ccp-dev.h

index 3a45c2af2fbd5a22d4a2599502d378819e3f257b..191274d410363b7ec2131185dce4135905cc42b5 100644 (file)
@@ -427,33 +427,33 @@ enum ccp_memtype {
 };
 #define        CCP_MEMTYPE_LSB CCP_MEMTYPE_KSB
 
+
 struct ccp_dma_info {
        dma_addr_t address;
        unsigned int offset;
        unsigned int length;
        enum dma_data_direction dir;
-};
+} __packed __aligned(4);
 
 struct ccp_dm_workarea {
        struct device *dev;
        struct dma_pool *dma_pool;
-       unsigned int length;
 
        u8 *address;
        struct ccp_dma_info dma;
+       unsigned int length;
 };
 
 struct ccp_sg_workarea {
        struct scatterlist *sg;
        int nents;
+       unsigned int sg_used;
 
        struct scatterlist *dma_sg;
        struct device *dma_dev;
        unsigned int dma_count;
        enum dma_data_direction dma_dir;
 
-       unsigned int sg_used;
-
        u64 bytes_left;
 };