* [PATCH net-next 1/1] net: ipa: use struct_size() for the interconnect array
@ 2022-03-11 16:24 Alex Elder
2022-03-12 7:00 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: Alex Elder @ 2022-03-11 16:24 UTC (permalink / raw)
To: davem, kuba
Cc: bjorn.andersson, mka, evgreen, cpratapa, avuyyuru, jponduru,
subashab, elder, netdev, linux-arm-msm, linux-kernel
In review for commit 8ee7ec4890e2b ("net: ipa: embed interconnect
array in the power structure"), Jakub Kicinski suggested that a
follow-up patch use struct_size() when computing the size of the
IPA power structure, which ends with a flexible array member.
Do that.
Suggested-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Alex Elder <elder@linaro.org>
---
drivers/net/ipa/ipa_power.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ipa/ipa_power.c b/drivers/net/ipa/ipa_power.c
index 16ece27d14d7e..db5ac7552286e 100644
--- a/drivers/net/ipa/ipa_power.c
+++ b/drivers/net/ipa/ipa_power.c
@@ -374,8 +374,8 @@ ipa_power_init(struct device *dev, const struct ipa_power_data *data)
goto err_clk_put;
}
- size = data->interconnect_count * sizeof(power->interconnect[0]);
- power = kzalloc(sizeof(*power) + size, GFP_KERNEL);
+ size = struct_size(power, interconnect, data->interconnect_count);
+ power = kzalloc(size, GFP_KERNEL);
if (!power) {
ret = -ENOMEM;
goto err_clk_put;
--
2.32.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next 1/1] net: ipa: use struct_size() for the interconnect array
2022-03-11 16:24 [PATCH net-next 1/1] net: ipa: use struct_size() for the interconnect array Alex Elder
@ 2022-03-12 7:00 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-03-12 7:00 UTC (permalink / raw)
To: Alex Elder
Cc: davem, kuba, bjorn.andersson, mka, evgreen, cpratapa, avuyyuru,
jponduru, subashab, elder, netdev, linux-arm-msm, linux-kernel
Hello:
This patch was applied to netdev/net-next.git (master)
by Jakub Kicinski <kuba@kernel.org>:
On Fri, 11 Mar 2022 10:24:23 -0600 you wrote:
> In review for commit 8ee7ec4890e2b ("net: ipa: embed interconnect
> array in the power structure"), Jakub Kicinski suggested that a
> follow-up patch use struct_size() when computing the size of the
> IPA power structure, which ends with a flexible array member.
>
> Do that.
>
> [...]
Here is the summary with links:
- [net-next,1/1] net: ipa: use struct_size() for the interconnect array
https://git.kernel.org/netdev/net-next/c/cb631a639819
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-03-12 7:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-11 16:24 [PATCH net-next 1/1] net: ipa: use struct_size() for the interconnect array Alex Elder
2022-03-12 7:00 ` patchwork-bot+netdevbpf
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.