* [PATCH v2] drm/i915/gt: Use kmemdup_array instead of kmemdup for multiple allocation
@ 2024-08-20 9:53 Yu Jiaoliang
2024-08-20 11:08 ` Andi Shyti
2024-08-20 12:53 ` Lucas De Marchi
0 siblings, 2 replies; 4+ messages in thread
From: Yu Jiaoliang @ 2024-08-20 9:53 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, Gustavo Sousa,
Shekhar Chauhan, intel-gfx, dri-devel, linux-kernel
Cc: opensource.kernel, Yu Jiaoliang, Jani Nikula
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
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 d90348c56765..0fcfd55c62b4 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_array(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] 4+ messages in thread* Re: [PATCH v2] drm/i915/gt: Use kmemdup_array instead of kmemdup for multiple allocation
2024-08-20 9:53 [PATCH v2] drm/i915/gt: Use kmemdup_array instead of kmemdup for multiple allocation Yu Jiaoliang
@ 2024-08-20 11:08 ` Andi Shyti
2024-08-20 12:53 ` Lucas De Marchi
1 sibling, 0 replies; 4+ messages in thread
From: Andi Shyti @ 2024-08-20 11:08 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, Gustavo Sousa,
Shekhar Chauhan, intel-gfx, dri-devel, linux-kernel,
opensource.kernel, Jani Nikula
Hi,
On Tue, Aug 20, 2024 at 05:53:02PM +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
>
> 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>
I didn't give you an explicit R-b, but that's fine, you can keep
it as I think the patch is fine.
> - struct i915_wa *list = kmemdup_array(wal->list,
> - wal->count, sizeof(*list),
> - GFP_KERNEL);
> + struct i915_wa *list = kmemdup_array(wal->list, wal->count,
> + sizeof(*list), GFP_KERNEL);
Do you see the indentation is off here? :-)
Please, run checkpatch.pl before sending the patch, as well.
Besides, what patch is this? Are you replacing kmemdup_array with
kmemdup_array? This v2 applies on your v1 while it should apply
on a clean drm-tip repository.
Thanks,
Andi
>
> if (list) {
> kfree(wal->list);
> --
> 2.34.1
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH v2] drm/i915/gt: Use kmemdup_array instead of kmemdup for multiple allocation
2024-08-20 9:53 [PATCH v2] drm/i915/gt: Use kmemdup_array instead of kmemdup for multiple allocation Yu Jiaoliang
2024-08-20 11:08 ` Andi Shyti
@ 2024-08-20 12:53 ` Lucas De Marchi
2024-08-20 13:41 ` Andi Shyti
1 sibling, 1 reply; 4+ messages in thread
From: Lucas De Marchi @ 2024-08-20 12:53 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, Tejas Upadhyay, Gustavo Sousa, Shekhar Chauhan,
intel-gfx, dri-devel, linux-kernel, opensource.kernel,
Jani Nikula
On Tue, Aug 20, 2024 at 05:53:02PM GMT, 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
>
>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 d90348c56765..0fcfd55c62b4 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_array(wal->list,
^
it was already kmemdup_array, not kmemdup. Am I missing anything?
Lucas De Marchi
>- 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] 4+ messages in thread* Re: [PATCH v2] drm/i915/gt: Use kmemdup_array instead of kmemdup for multiple allocation
2024-08-20 12:53 ` Lucas De Marchi
@ 2024-08-20 13:41 ` Andi Shyti
0 siblings, 0 replies; 4+ messages in thread
From: Andi Shyti @ 2024-08-20 13:41 UTC (permalink / raw)
To: Lucas De Marchi
Cc: Yu Jiaoliang, Jani Nikula, Joonas Lahtinen, Rodrigo Vivi,
Tvrtko Ursulin, David Airlie, Daniel Vetter, Matt Roper,
Andi Shyti, Michal Mrozek, Tejas Upadhyay, Gustavo Sousa,
Shekhar Chauhan, intel-gfx, dri-devel, linux-kernel,
opensource.kernel, Jani Nikula
Hi Lucas,
On Tue, Aug 20, 2024 at 07:53:10AM -0500, Lucas De Marchi wrote:
> On Tue, Aug 20, 2024 at 05:53:02PM GMT, 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
> >
> > 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 d90348c56765..0fcfd55c62b4 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_array(wal->list,
>
> ^
>
> it was already kmemdup_array, not kmemdup. Am I missing anything?
I see kmemdup() in drm-tip.
What Yu has done here is to change kmemdup to kmemdup_array and
send the patch. Received the reviews and made a new commit on top
of the previous one; then he sent only this second commit.
Yu needs to make sure that:
1. the patch applies correctly on a clean drm-tip
2. drm-tip + patch compiles
3. there are no checkpatch and sparse new errors
We missed point 1 here :-)
Andi
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-08-20 13:41 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-20 9:53 [PATCH v2] drm/i915/gt: Use kmemdup_array instead of kmemdup for multiple allocation Yu Jiaoliang
2024-08-20 11:08 ` Andi Shyti
2024-08-20 12:53 ` Lucas De Marchi
2024-08-20 13:41 ` Andi Shyti
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®