From: Christophe JAILLET Date: Sat, 7 Oct 2023 13:50:02 +0000 (+0200) Subject: media: vde: Use struct_size() X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=aebe6f055d9f0e82a61ffb7c5c45f6c3af54b76b;p=linux.git media: vde: Use struct_size() Use struct_size() which is much more common than this offsetof(). Signed-off-by: Christophe JAILLET Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/platform/nvidia/tegra-vde/v4l2.c b/drivers/media/platform/nvidia/tegra-vde/v4l2.c index bd8c207d5b54c..0f48ce6f243e8 100644 --- a/drivers/media/platform/nvidia/tegra-vde/v4l2.c +++ b/drivers/media/platform/nvidia/tegra-vde/v4l2.c @@ -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;