mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-05 15:49:42 -04:00
drm/i915/query: 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: Gustavo A. R. Silva <gustavoars@kernel.org> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Link: https://patchwork.freedesktop.org/patch/msgid/20200617220331.GA19550@embeddedor
This commit is contained in:
committed by
Chris Wilson
parent
810b7ee300
commit
bf3c508375
@@ -113,8 +113,7 @@ query_engine_info(struct drm_i915_private *i915,
|
||||
for_each_uabi_engine(engine, i915)
|
||||
num_uabi_engines++;
|
||||
|
||||
len = sizeof(struct drm_i915_query_engine_info) +
|
||||
num_uabi_engines * sizeof(struct drm_i915_engine_info);
|
||||
len = struct_size(query_ptr, engines, num_uabi_engines);
|
||||
|
||||
ret = copy_query_item(&query, sizeof(query), len, query_item);
|
||||
if (ret != 0)
|
||||
|
||||
Reference in New Issue
Block a user