Re: [PATCH net-next v2] ice: Adjust over allocation of memory in ice_sched_add_root_node() and ice_sched_add_node()

From: Simon Horman
Date: Mon Jul 08 2024 - 03:30:03 EST


On Sat, Jul 06, 2024 at 05:05:18PM +0300, Aleksandr Mishin wrote:
> In ice_sched_add_root_node() and ice_sched_add_node() there are calls to
> devm_kcalloc() in order to allocate memory for array of pointers to
> 'ice_sched_node' structure. But in this calls there are 'sizeof(*root)'
> instead of 'sizeof(root)' and 'sizeof(*node)' instead of 'sizeof(node)'.
> So memory is allocated for structures instead pointers. This lead to
> significant over allocation of memory.
>
> Adjust over allocation of memory by correcting devm_kcalloc() parameters.
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
> Suggested-by: Simon Horman <horms@xxxxxxxxxx>

FTR, I did provide some review of v1.
But I don't think that counts as suggesting this patch.

> Signed-off-by: Aleksandr Mishin <amishin@xxxxxxxxxx>
> ---
> v2:
> - Update comment, remove 'Fixes' tag and change the tree from 'net' to
> 'net-next' as suggested by Simon
> (https://lore.kernel.org/all/20240706095258.GB1481495@xxxxxxxxxx/)
> v1: https://lore.kernel.org/all/20240705163620.12429-1-amishin@xxxxxxxxxx/

Also, v2 was sent less than 24h after v1,
please don't do that when posting patches to netdev.

Please do read
https://docs.kernel.org/process/maintainer-netdev.html

...