linux/drivers/crypto/qat/qat_common
Gustavo A. R. Silva 1793d1aba1 crypto: qat - use struct_size() helper
One of the more common cases of allocation size calculations is finding
the size of a structure that has a zero-sized array at the end, along
with memory for some number of elements for that array. For example:

struct qat_alg_buf_list {
	...
        struct qat_alg_buf bufers[];
} __packed __aligned(64);

Make use of the struct_size() helper instead of an open-coded version
in order to avoid any potential type mistakes.

So, replace the following form:

sizeof(struct qat_alg_buf_list) + ((1 + n) * sizeof(struct qat_alg_buf))

with:

struct_size(bufl, bufers, n + 1)

This code was detected with the help of Coccinelle.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2019-06-13 14:31:41 +08:00
..
adf_accel_devices.h
adf_accel_engine.c
adf_admin.c cross-tree: phase out dma_zalloc_coherent() 2019-01-08 07:58:37 -05:00
adf_aer.c PCI/AER: Remove pci_cleanup_aer_uncorrect_error_status() calls 2018-10-02 16:04:40 -05:00
adf_cfg_common.h
adf_cfg_strings.h
adf_cfg_user.h
adf_cfg.c crypto: qat - no need to check return value of debugfs_create functions 2019-02-01 14:42:03 +08:00
adf_cfg.h
adf_common_drv.h
adf_ctl_drv.c
adf_dev_mgr.c
adf_hw_arbiter.c
adf_init.c
adf_isr.c treewide: kzalloc_node() -> kcalloc_node() 2018-06-12 16:19:22 -07:00
adf_pf2vf_msg.c
adf_pf2vf_msg.h
adf_sriov.c
adf_transport_access_macros.h
adf_transport_debug.c crypto: qat - no need to check return value of debugfs_create functions 2019-02-01 14:42:03 +08:00
adf_transport_internal.h
adf_transport.c crypto: qat - Remove unused goto label 2019-02-08 15:30:09 +08:00
adf_transport.h
adf_vf2pf_msg.c
adf_vf_isr.c
icp_qat_fw_init_admin.h
icp_qat_fw_la.h
icp_qat_fw_loader_handle.h
icp_qat_fw_pke.h
icp_qat_fw.h
icp_qat_hal.h
icp_qat_hw.h
icp_qat_uclo.h
Makefile
qat_algs.c crypto: qat - use struct_size() helper 2019-06-13 14:31:41 +08:00
qat_asym_algs.c crypto: rsa - unimplement sign/verify for raw RSA backends 2019-04-18 22:15:02 +08:00
qat_crypto.c
qat_crypto.h crypto: qat - update iv after encryption or decryption operations 2019-05-23 14:01:02 +08:00
qat_hal.c
qat_uclo.c treewide: kzalloc() -> kcalloc() 2018-06-12 16:19:22 -07:00