* [PATCH v3] drm/i915/gt: Use kmemdup_array instead of kmemdup for multiple allocation
@ 2024-08-21 2:41 Yu Jiaoliang
2024-08-23 23:32 ` Andi Shyti
0 siblings, 1 reply; 3+ messages in thread
From: Yu Jiaoliang @ 2024-08-21 2:41 UTC (permalink / raw)
To: Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, Tvrtko Ursulin,
David Airlie, Daniel Vetter, Matt Roper, Andi Shyti,
Michal Mrozek, Lucas De Marchi, Tejas Upadhyay, Shekhar Chauhan,
Gustavo Sousa, intel-gfx, dri-devel, linux-kernel
Cc: opensource.kernel
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 <yujiaoliang@vivo.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>
---
drivers/gpu/drm/i915/gt/intel_workarounds.c | 5 ++---
1 file 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 09a287c1aedd..3ac0213c711f 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);
--
2.34.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v3] drm/i915/gt: Use kmemdup_array instead of kmemdup for multiple allocation
2024-08-21 2:41 [PATCH v3] drm/i915/gt: Use kmemdup_array instead of kmemdup for multiple allocation Yu Jiaoliang
@ 2024-08-23 23:32 ` Andi Shyti
2024-08-26 1:56 ` 于佼良
0 siblings, 1 reply; 3+ messages in thread
From: Andi Shyti @ 2024-08-23 23:32 UTC (permalink / raw)
To: Yu Jiaoliang
Cc: Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, Tvrtko Ursulin,
David Airlie, Daniel Vetter, Matt Roper, Andi Shyti,
Michal Mrozek, Lucas De Marchi, Tejas Upadhyay, Shekhar Chauhan,
Gustavo Sousa, intel-gfx, dri-devel, linux-kernel,
opensource.kernel
Hi Yu,
On Wed, Aug 21, 2024 at 10:41:27AM +0800, Yu Jiaoliang wrote:
> 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 <yujiaoliang@vivo.com>
> Reviewed-by: Jani Nikula <jani.nikula@intel.com>
> Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>
merged to drm-intel-gt-next.
Thanks,
Andi
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v3] drm/i915/gt: Use kmemdup_array instead of kmemdup for multiple allocation
2024-08-23 23:32 ` Andi Shyti
@ 2024-08-26 1:56 ` 于佼良
0 siblings, 0 replies; 3+ messages in thread
From: 于佼良 @ 2024-08-26 1:56 UTC (permalink / raw)
To: Andi Shyti
Cc: Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, Tvrtko Ursulin,
David Airlie, Daniel Vetter, Matt Roper, Michal Mrozek,
Lucas De Marchi, Tejas Upadhyay, Shekhar Chauhan, Gustavo Sousa,
intel-gfx, dri-devel, linux-kernel, opensource.kernel
在 2024/8/24 7:32, Andi Shyti 写道:
> [Some people who received this message don't often get email from andi.shyti@linux.intel.com. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
>
> Hi Yu,
>
> On Wed, Aug 21, 2024 at 10:41:27AM +0800, Yu Jiaoliang wrote:
>> 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 <yujiaoliang@vivo.com>
>> Reviewed-by: Jani Nikula <jani.nikula@intel.com>
>> Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>
> merged to drm-intel-gt-next.
>
> Thanks,
> Andi
Hi Andi,
Thanks for your review.
Best Regards,
Yu
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-08-26 1:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-21 2:41 [PATCH v3] drm/i915/gt: Use kmemdup_array instead of kmemdup for multiple allocation Yu Jiaoliang
2024-08-23 23:32 ` Andi Shyti
2024-08-26 1:56 ` 于佼良
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®