Skip to content

Commit b50a8b0

Browse files
tititiou36kuba-moo
authored andcommitted
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>
1 parent b1cf7a5 commit b50a8b0

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

net/openvswitch/meter.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,7 @@ static struct dp_meter_instance *dp_meter_instance_alloc(const u32 size)
6969
{
7070
struct dp_meter_instance *ti;
7171

72-
ti = kvzalloc(sizeof(*ti) +
73-
sizeof(struct dp_meter *) * size,
74-
GFP_KERNEL);
72+
ti = kvzalloc(struct_size(ti, dp_meters, size), GFP_KERNEL);
7573
if (!ti)
7674
return NULL;
7775

0 commit comments

Comments
 (0)