diff options
author | Alex Elder <elder@linaro.org> | 2022-03-11 10:24:23 -0600 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2022-03-11 22:50:07 -0800 |
commit | cb631a6398192f79f33a2480517c272120985020 (patch) | |
tree | 5cb4538b60f7b4c578065add9b553c8500f730a1 /drivers/net/ipa | |
parent | 0b3660695e80d53d1bab5b458f3a897a2c427a59 (diff) | |
download | linux-cb631a6398192f79f33a2480517c272120985020.tar.gz linux-cb631a6398192f79f33a2480517c272120985020.tar.bz2 linux-cb631a6398192f79f33a2480517c272120985020.zip |
net: ipa: use struct_size() for the interconnect array
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>
Link: https://lore.kernel.org/r/20220311162423.872645-1-elder@linaro.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'drivers/net/ipa')
-rw-r--r-- | drivers/net/ipa/ipa_power.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/net/ipa/ipa_power.c b/drivers/net/ipa/ipa_power.c index 16ece27d14d7..db5ac7552286 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; |