linux-sg2042/drivers/remoteproc
Gustavo A. R. Silva c878465715 remoteproc: 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 fw_rsc_vdev {
	...
        struct fw_rsc_vdev_vring vring[0];
} __packed;

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(*rsc) + rsc->num_of_vrings * sizeof(struct fw_rsc_vdev_vring)

with:

struct_size(rsc, vring, rsc->num_of_vrings)

This code was detected with the help of Coccinelle.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Link: https://lore.kernel.org/r/20190830151406.GA23274@embeddedor
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2020-01-20 10:50:54 -08:00
..
Kconfig rpmsg: add rpmsg support for mt8183 SCP. 2020-01-20 10:29:56 -08:00
Makefile remoteproc/mediatek: add SCP support for mt8183 2020-01-20 10:29:54 -08:00
da8xx_remoteproc.c remoteproc: Remove dev_err() usage after platform_get_irq() 2019-08-26 21:59:58 -07:00
imx_rproc.c remoteproc updates for v5.3 2019-07-17 11:44:41 -07:00
keystone_remoteproc.c remoteproc: Remove dev_err() usage after platform_get_irq() 2019-08-26 21:59:58 -07:00
mtk_common.h rpmsg: add rpmsg support for mt8183 SCP. 2020-01-20 10:29:56 -08:00
mtk_scp.c rpmsg: add rpmsg support for mt8183 SCP. 2020-01-20 10:29:56 -08:00
mtk_scp_ipi.c rpmsg: add rpmsg support for mt8183 SCP. 2020-01-20 10:29:56 -08:00
omap_remoteproc.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 174 2019-05-30 11:26:41 -07:00
omap_remoteproc.h remoteproc/omap: add a remoteproc driver for OMAP4 2012-02-08 22:53:47 +02:00
qcom_common.c remoteproc: qcom: Move glink_ssr notification after stop 2019-07-24 16:01:14 -07:00
qcom_common.h remoteproc: qcom: Introduce sysmon 2018-02-12 16:57:22 -08:00
qcom_q6v5.c remoteproc: Remove dev_err() usage after platform_get_irq() 2019-08-26 21:59:58 -07:00
qcom_q6v5.h remoteproc: q6v5: Extract common resource handling 2018-06-18 15:55:57 -07:00
qcom_q6v5_adsp.c remoteproc: qcom: qdsp6-adsp: Add support for QCS404 CDSP 2019-05-21 23:52:52 -07:00
qcom_q6v5_mss.c remoteproc: mss: q6v5-mss: Add modem support on SC7180 2019-12-20 10:47:12 -08:00
qcom_q6v5_pas.c remoteproc: qcom: pas: Add MSM8998 ADSP and SLPI support 2019-12-20 09:58:53 -08:00
qcom_q6v5_wcss.c remoteproc: qcom: Introduce Hexagon V5 based WCSS driver 2018-06-18 15:57:58 -07:00
qcom_sysmon.c remoteproc: qcom: Remove unneeded semicolon 2019-12-18 23:13:29 -08:00
qcom_wcnss.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 174 2019-05-30 11:26:41 -07:00
qcom_wcnss.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
qcom_wcnss_iris.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 174 2019-05-30 11:26:41 -07:00
remoteproc_core.c remoteproc: use struct_size() helper 2020-01-20 10:50:54 -08:00
remoteproc_debugfs.c remoteproc: debug: Remove unneeded NULL check 2019-10-04 21:11:57 -07:00
remoteproc_elf_loader.c remoteproc updates for v5.3 2019-07-17 11:44:41 -07:00
remoteproc_internal.h remoteproc updates for v5.3 2019-07-17 11:44:41 -07:00
remoteproc_sysfs.c remoteproc: Add a sysfs interface for name 2019-08-26 14:50:16 -07:00
remoteproc_virtio.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 282 2019-06-05 17:36:37 +02:00
st_remoteproc.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
st_slim_rproc.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
stm32_rproc.c remoteproc: stm32: fix probe error case 2019-11-18 20:35:16 -08:00
wkup_m3_rproc.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 174 2019-05-30 11:26:41 -07:00