Skip to content

Commit 3126d5f

Browse files
Yu JiaoliangAndi Shyti
authored andcommitted
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]
1 parent 6628851 commit 3126d5f

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

drivers/gpu/drm/i915/gt/intel_workarounds.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,8 @@ static void wa_init_finish(struct i915_wa_list *wal)
111111
{
112112
/* Trim unused entries. */
113113
if (!IS_ALIGNED(wal->count, WA_LIST_CHUNK)) {
114-
struct i915_wa *list = kmemdup(wal->list,
115-
wal->count * sizeof(*list),
116-
GFP_KERNEL);
114+
struct i915_wa *list = kmemdup_array(wal->list, wal->count,
115+
sizeof(*list), GFP_KERNEL);
117116

118117
if (list) {
119118
kfree(wal->list);

0 commit comments

Comments
 (0)