mirror of
https://github.com/torvalds/linux.git
synced 2024-11-21 19:41:42 +00:00
crypto: qat - Avoid -Wflex-array-member-not-at-end warnings
-Wflex-array-member-not-at-end is coming in GCC-14, and we are getting ready to enable it globally. Use the `__struct_group()` helper to separate the flexible array from the rest of the members in flexible `struct qat_alg_buf_list`, through tagged `struct qat_alg_buf_list_hdr`, and avoid embedding the flexible-array member in the middle of `struct qat_alg_fixed_buf_list`. Also, use `container_of()` whenever we need to retrieve a pointer to the flexible structure. So, with these changes, fix the following warnings: drivers/crypto/intel/qat/qat_common/qat_bl.h:25:33: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end] drivers/crypto/intel/qat/qat_common/qat_bl.h:25:33: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end] drivers/crypto/intel/qat/qat_common/qat_bl.h:25:33: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end] drivers/crypto/intel/qat/qat_common/qat_bl.h:25:33: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end] drivers/crypto/intel/qat/qat_common/qat_bl.h:25:33: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end] drivers/crypto/intel/qat/qat_common/qat_bl.h:25:33: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end] drivers/crypto/intel/qat/qat_common/qat_bl.h:25:33: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end] drivers/crypto/intel/qat/qat_common/qat_bl.h:25:33: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end] Link: https://github.com/KSPP/linux/issues/202 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>
This commit is contained in:
parent
a9a7214053
commit
140e4c85d5
@ -81,7 +81,8 @@ static int __qat_bl_sgl_to_bufl(struct adf_accel_dev *accel_dev,
|
||||
if (unlikely(!bufl))
|
||||
return -ENOMEM;
|
||||
} else {
|
||||
bufl = &buf->sgl_src.sgl_hdr;
|
||||
bufl = container_of(&buf->sgl_src.sgl_hdr,
|
||||
struct qat_alg_buf_list, hdr);
|
||||
memset(bufl, 0, sizeof(struct qat_alg_buf_list));
|
||||
buf->sgl_src_valid = true;
|
||||
}
|
||||
@ -139,7 +140,8 @@ static int __qat_bl_sgl_to_bufl(struct adf_accel_dev *accel_dev,
|
||||
if (unlikely(!buflout))
|
||||
goto err_in;
|
||||
} else {
|
||||
buflout = &buf->sgl_dst.sgl_hdr;
|
||||
buflout = container_of(&buf->sgl_dst.sgl_hdr,
|
||||
struct qat_alg_buf_list, hdr);
|
||||
memset(buflout, 0, sizeof(struct qat_alg_buf_list));
|
||||
buf->sgl_dst_valid = true;
|
||||
}
|
||||
|
@ -15,14 +15,17 @@ struct qat_alg_buf {
|
||||
} __packed;
|
||||
|
||||
struct qat_alg_buf_list {
|
||||
u64 resrvd;
|
||||
u32 num_bufs;
|
||||
u32 num_mapped_bufs;
|
||||
/* New members must be added within the __struct_group() macro below. */
|
||||
__struct_group(qat_alg_buf_list_hdr, hdr, __packed,
|
||||
u64 resrvd;
|
||||
u32 num_bufs;
|
||||
u32 num_mapped_bufs;
|
||||
);
|
||||
struct qat_alg_buf buffers[];
|
||||
} __packed;
|
||||
|
||||
struct qat_alg_fixed_buf_list {
|
||||
struct qat_alg_buf_list sgl_hdr;
|
||||
struct qat_alg_buf_list_hdr sgl_hdr;
|
||||
struct qat_alg_buf descriptors[QAT_MAX_BUFF_DESC];
|
||||
} __packed __aligned(64);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user