aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYu Jiaoliang <[email protected]>2024-08-21 16:40:36 +0200
committerAndi Shyti <[email protected]>2024-08-24 01:13:08 +0200
commit3126d5fff54368288e7fe1c0fd4ecb36b868e5aa (patch)
tree66a6ce5d28b07fbe941c4f19d8c8446b6962a4d3
parent6628851159c77cf5666160e0272d46acc0772a6c (diff)
drm/i915/gt: Use kmemdup_array instead of kmemdup for multiple allocation
Let the kememdup_array() take care about multiplication and possible overflows. v2: - Change subject - Leave one blank line between the commit log and the tag section - Fix code alignment issue v3: - Fix code alignment - Apply the patch on a clean drm-tip Signed-off-by: Yu Jiaoliang <[email protected]> Reviewed-by: Jani Nikula <[email protected]> Reviewed-by: Andi Shyti <[email protected]> Signed-off-by: Andi Shyti <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
-rw-r--r--drivers/gpu/drm/i915/gt/intel_workarounds.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/gpu/drm/i915/gt/intel_workarounds.c b/drivers/gpu/drm/i915/gt/intel_workarounds.c
index bfe6d8fc820f..baa609bdf7cb 100644
--- a/drivers/gpu/drm/i915/gt/intel_workarounds.c
+++ b/drivers/gpu/drm/i915/gt/intel_workarounds.c
@@ -111,9 +111,8 @@ static void wa_init_finish(struct i915_wa_list *wal)
{
/* Trim unused entries. */
if (!IS_ALIGNED(wal->count, WA_LIST_CHUNK)) {
- struct i915_wa *list = kmemdup(wal->list,
- wal->count * sizeof(*list),
- GFP_KERNEL);
+ struct i915_wa *list = kmemdup_array(wal->list, wal->count,
+ sizeof(*list), GFP_KERNEL);
if (list) {
kfree(wal->list);