net: openvswitch: Use struct_size()
Use struct_size() instead of hand writing it. This is less verbose and more informative. Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Acked-by: Eelco Chaudron <echaudro@redhat.com> Link: https://lore.kernel.org/r/e7746fbbd62371d286081d5266e88bbe8d3fe9f0.1683388991.git.christophe.jaillet@wanadoo.fr Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
b1cf7a5615
commit
b50a8b0d57
@ -69,9 +69,7 @@ static struct dp_meter_instance *dp_meter_instance_alloc(const u32 size)
|
||||
{
|
||||
struct dp_meter_instance *ti;
|
||||
|
||||
ti = kvzalloc(sizeof(*ti) +
|
||||
sizeof(struct dp_meter *) * size,
|
||||
GFP_KERNEL);
|
||||
ti = kvzalloc(struct_size(ti, dp_meters, size), GFP_KERNEL);
|
||||
if (!ti)
|
||||
return NULL;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user