Commit 4f88b4cc authored by Gustavo A. R. Silva's avatar Gustavo A. R. Silva Committed by Roland Scheidegger

drm/vmwgfx: Use struct_size() helper

Make use of the struct_size() helper instead of an open-coded version
in order to avoid any potential type mistakes.

This code was detected with the help of Coccinelle and, audited and
fixed manually.
Signed-off-by: default avatarGustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: default avatarRoland Scheidegger <sroland@vmware.com>
parent dc100bc8
...@@ -1969,7 +1969,7 @@ static int vmw_surface_dirty_alloc(struct vmw_resource *res) ...@@ -1969,7 +1969,7 @@ static int vmw_surface_dirty_alloc(struct vmw_resource *res)
num_mip = 1; num_mip = 1;
num_subres = num_layers * num_mip; num_subres = num_layers * num_mip;
dirty_size = sizeof(*dirty) + num_subres * sizeof(dirty->boxes[0]); dirty_size = struct_size(dirty, boxes, num_subres);
acc_size = ttm_round_pot(dirty_size); acc_size = ttm_round_pot(dirty_size);
ret = ttm_mem_global_alloc(vmw_mem_glob(res->dev_priv), ret = ttm_mem_global_alloc(vmw_mem_glob(res->dev_priv),
acc_size, &ctx); acc_size, &ctx);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment