diff options
author | Jacob Keller <jacob.e.keller@intel.com> | 2023-02-23 04:35:33 +0300 |
---|---|---|
committer | Heiko Stuebner <heiko@sntech.de> | 2023-03-09 03:58:55 +0300 |
commit | 3b4db36c4cd9e7e49babe931d7117cdba0d04ce0 (patch) | |
tree | 47912a860ffaaa0bd3e26c2c8a1b1debeb61a77b /drivers/gpu/drm | |
parent | d13b10ec6696b0c523fa21b65c7ff6f246a49560 (diff) | |
download | linux-3b4db36c4cd9e7e49babe931d7117cdba0d04ce0.tar.xz |
drm/rockchip: vop2: use struct_size() in vop2_bind
Use the overflow-protected struct_size() helper macro to compute the
allocation size of the vop2 data structure.
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Cc: Sandy Huang <hjc@rock-chips.com>
Cc: Heiko Stübner <heiko@sntech.de>
Cc: David Airlie <airlied@gmail.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20230223013533.1707706-1-jacob.e.keller@intel.com
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r-- | drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c index 0e0012368976..3e5861653b69 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c @@ -2655,7 +2655,7 @@ static int vop2_bind(struct device *dev, struct device *master, void *data) return -ENODEV; /* Allocate vop2 struct and its vop2_win array */ - alloc_size = sizeof(*vop2) + sizeof(*vop2->win) * vop2_data->win_size; + alloc_size = struct_size(vop2, win, vop2_data->win_size); vop2 = devm_kzalloc(dev, alloc_size, GFP_KERNEL); if (!vop2) return -ENOMEM; |