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

Configure Feed

Select the types of activity you want to include in your feed.

crypto: qat - Use static_assert() to check struct sizes

Commit 140e4c85d540 ("crypto: qat - Avoid -Wflex-array-member-not-at-end
warnings") introduced tagged `struct qat_alg_buf_list_hdr`. We want to
ensure that when new members need to be added to the flexible structure,
they are always included within this tagged struct.

So, we use `static_assert()` to ensure that the memory layout for
both the flexible structure and the tagged struct is the same after
any changes.

Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Acked-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Gustavo A. R. Silva and committed by
Herbert Xu
8caa061c 9369693a

+2
+2
drivers/crypto/intel/qat/qat_common/qat_bl.h
··· 23 23 ); 24 24 struct qat_alg_buf buffers[]; 25 25 } __packed; 26 + static_assert(offsetof(struct qat_alg_buf_list, buffers) == sizeof(struct qat_alg_buf_list_hdr), 27 + "struct member likely outside of __struct_group()"); 26 28 27 29 struct qat_alg_fixed_buf_list { 28 30 struct qat_alg_buf_list_hdr sgl_hdr;