diff mbox series

firmware: arm_ffa: Fix the size of the allocation in ffa_partitions_cleanup()

Message ID 20231031141335.3077026-1-sudeep.holla@arm.com (mailing list archive)
State New, archived
Headers show
Series firmware: arm_ffa: Fix the size of the allocation in ffa_partitions_cleanup() | expand

Commit Message

Sudeep Holla Oct. 31, 2023, 2:13 p.m. UTC
Arry of pointer to struct ffa_dev_part_info needs to be allocated to
fetch the pointers stored in XArray. However, currently we allocate the
entire structure instead of just pointers.

Fix the allocation size. This will also eliminate the below Smatch
istatic checker warning:

   |   drivers/firmware/arm_ffa/driver.c:1251 ffa_partitions_cleanup()
   |   warn: double check that we're allocating correct size: 8 vs 88

Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/all/0e8ddbca-d9da-4a3b-aae3-328993b62ba2@moroto.mountain
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
---
 drivers/firmware/arm_ffa/driver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Sudeep Holla Nov. 13, 2023, 12:25 p.m. UTC | #1
On Tue, 31 Oct 2023 14:13:35 +0000, Sudeep Holla wrote:
> Arry of pointer to struct ffa_dev_part_info needs to be allocated to
> fetch the pointers stored in XArray. However, currently we allocate the
> entire structure instead of just pointers.
> 
> Fix the allocation size. This will also eliminate the below Smatch
> istatic checker warning:
> 
> [...]

Applied to sudeep.holla/linux (for-next/ffa/fixes), thanks!

[1/1] firmware: arm_ffa: Fix the size of the allocation in ffa_partitions_cleanup()
      https://git.kernel.org/sudeep.holla/c/05857a1eb723
--
Regards,
Sudeep
diff mbox series

Patch

diff --git a/drivers/firmware/arm_ffa/driver.c b/drivers/firmware/arm_ffa/driver.c
index 4a1d9e2d708e..93a7f8f1709b 100644
--- a/drivers/firmware/arm_ffa/driver.c
+++ b/drivers/firmware/arm_ffa/driver.c
@@ -1251,7 +1251,7 @@  static void ffa_partitions_cleanup(void)
 	if (!count)
 		return;
 
-	info = kcalloc(count, sizeof(**info), GFP_KERNEL);
+	info = kcalloc(count, sizeof(*info), GFP_KERNEL);
 	if (!info)
 		return;