]> git.itanic.dy.fi Git - linux-stable/commitdiff
firmware: arm_ffa: Fix the size of the allocation in ffa_partitions_cleanup()
authorSudeep Holla <sudeep.holla@arm.com>
Tue, 31 Oct 2023 14:13:35 +0000 (14:13 +0000)
committerSudeep Holla <sudeep.holla@arm.com>
Mon, 13 Nov 2023 11:51:26 +0000 (11:51 +0000)
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>
drivers/firmware/arm_ffa/driver.c

index 49ebdc2775ddc9532e656a8cfb61b5cc7c59e58b..034bce8a2ca1a30b440c81110d5de4719c33641e 100644 (file)
@@ -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;