]> git.itanic.dy.fi Git - linux-stable/commitdiff
media: vde: Use struct_size()
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Sat, 7 Oct 2023 13:50:02 +0000 (15:50 +0200)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Thu, 23 Nov 2023 12:33:38 +0000 (13:33 +0100)
Use struct_size() which is much more common than this offsetof().

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
drivers/media/platform/nvidia/tegra-vde/v4l2.c

index bd8c207d5b54c6b9dbd9921c6298253ad6d5a85f..0f48ce6f243e8c52af0c32e4f44e73dac67298a7 100644 (file)
@@ -813,7 +813,7 @@ static int tegra_open(struct file *file)
        struct tegra_ctx *ctx;
        int err;
 
-       ctx = kzalloc(offsetof(struct tegra_ctx, ctrls[ARRAY_SIZE(ctrl_cfgs)]),
+       ctx = kzalloc(struct_size(ctx, ctrls, ARRAY_SIZE(ctrl_cfgs)),
                      GFP_KERNEL);
        if (!ctx)
                return -ENOMEM;