mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-17 01:04:19 +08:00
77e5a44879
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 resource_table { ... u32 offset[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: table->num * sizeof(table->offset[0]) + sizeof(struct resource_table) with: struct_size(table, offset, table->num) This code was detected with the help of Coccinelle. Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> |
||
---|---|---|
.. | ||
da8xx_remoteproc.c | ||
imx_rproc.c | ||
Kconfig | ||
keystone_remoteproc.c | ||
Makefile | ||
omap_remoteproc.c | ||
omap_remoteproc.h | ||
qcom_common.c | ||
qcom_common.h | ||
qcom_q6v5_adsp.c | ||
qcom_q6v5_mss.c | ||
qcom_q6v5_pas.c | ||
qcom_q6v5_wcss.c | ||
qcom_q6v5.c | ||
qcom_q6v5.h | ||
qcom_sysmon.c | ||
qcom_wcnss_iris.c | ||
qcom_wcnss.c | ||
qcom_wcnss.h | ||
remoteproc_core.c | ||
remoteproc_debugfs.c | ||
remoteproc_elf_loader.c | ||
remoteproc_internal.h | ||
remoteproc_sysfs.c | ||
remoteproc_virtio.c | ||
st_remoteproc.c | ||
st_slim_rproc.c | ||
wkup_m3_rproc.c |