Skip to content

Commit

Permalink
firmware: arm_ffa: Fix the size of the allocation in ffa_partitions_c…
Browse files Browse the repository at this point in the history
…leanup()

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
Link: https://lore.kernel.org/r/20231031141335.3077026-1-sudeep.holla@arm.com
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
  • Loading branch information
sudeep-holla committed Nov 13, 2023
1 parent 6d67cbe commit 05857a1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/firmware/arm_ffa/driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -1248,7 +1248,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;

Expand Down

0 comments on commit 05857a1

Please sign in to comment.