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

crypto: ccp - Rearrange structure members to minimize size

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>

authored by

Gary R Hook and committed by
Herbert Xu
2d158391 51de7dd0

+4 -4
+4 -4
drivers/crypto/ccp/ccp-dev.h
··· 427 427 }; 428 428 #define CCP_MEMTYPE_LSB CCP_MEMTYPE_KSB 429 429 430 + 430 431 struct ccp_dma_info { 431 432 dma_addr_t address; 432 433 unsigned int offset; 433 434 unsigned int length; 434 435 enum dma_data_direction dir; 435 - }; 436 + } __packed __aligned(4); 436 437 437 438 struct ccp_dm_workarea { 438 439 struct device *dev; 439 440 struct dma_pool *dma_pool; 440 - unsigned int length; 441 441 442 442 u8 *address; 443 443 struct ccp_dma_info dma; 444 + unsigned int length; 444 445 }; 445 446 446 447 struct ccp_sg_workarea { 447 448 struct scatterlist *sg; 448 449 int nents; 450 + unsigned int sg_used; 449 451 450 452 struct scatterlist *dma_sg; 451 453 struct device *dma_dev; 452 454 unsigned int dma_count; 453 455 enum dma_data_direction dma_dir; 454 - 455 - unsigned int sg_used; 456 456 457 457 u64 bytes_left; 458 458 };