From: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
To: Marco Pagani <marpagan@redhat.com>
Cc: Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>,
Oded Gabbay <ogabbay@kernel.org>,
kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org,
dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] accel/ivpu: Use struct_size()
Date: Thu, 8 Jun 2023 07:57:54 +0200 [thread overview]
Message-ID: <20230608055754.GD324119@linux.intel.com> (raw)
In-Reply-To: <3475be3b-11d5-96fe-6bc4-26d0e3a270df@redhat.com>
On Thu, Jun 01, 2023 at 05:58:48PM +0200, Marco Pagani wrote:
>
> On 2023-05-29 15:28, Christophe JAILLET wrote:
> > Use struct_size() instead of hand-writing it. It is less verbose, more
> > robust and more informative.
> >
> > Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
>
> Reviewed-by: Marco Pagani <marpagan@redhat.com>
Applied to drm-misc-next
Thanks
Stanislaw
>
> > ---
> > drivers/accel/ivpu/ivpu_job.c | 4 +---
> > 1 file changed, 1 insertion(+), 3 deletions(-)
> >
> > diff --git a/drivers/accel/ivpu/ivpu_job.c b/drivers/accel/ivpu/ivpu_job.c
> > index 3c6f1e16cf2f..0a09bba8da24 100644
> > --- a/drivers/accel/ivpu/ivpu_job.c
> > +++ b/drivers/accel/ivpu/ivpu_job.c
> > @@ -289,15 +289,13 @@ ivpu_create_job(struct ivpu_file_priv *file_priv, u32 engine_idx, u32 bo_count)
> > {
> > struct ivpu_device *vdev = file_priv->vdev;
> > struct ivpu_job *job;
> > - size_t buf_size;
> > int ret;
> >
> > ret = ivpu_rpm_get(vdev);
> > if (ret < 0)
> > return NULL;
> >
> > - buf_size = sizeof(*job) + bo_count * sizeof(struct ivpu_bo *);
> > - job = kzalloc(buf_size, GFP_KERNEL);
> > + job = kzalloc(struct_size(job, bos, bo_count), GFP_KERNEL);
> > if (!job)
> > goto err_rpm_put;
> >
>
WARNING: multiple messages have this Message-ID (diff)
From: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
To: Marco Pagani <marpagan@redhat.com>
Cc: Oded Gabbay <ogabbay@kernel.org>,
kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org,
dri-devel@lists.freedesktop.org,
Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
Subject: Re: [PATCH] accel/ivpu: Use struct_size()
Date: Thu, 8 Jun 2023 07:57:54 +0200 [thread overview]
Message-ID: <20230608055754.GD324119@linux.intel.com> (raw)
In-Reply-To: <3475be3b-11d5-96fe-6bc4-26d0e3a270df@redhat.com>
On Thu, Jun 01, 2023 at 05:58:48PM +0200, Marco Pagani wrote:
>
> On 2023-05-29 15:28, Christophe JAILLET wrote:
> > Use struct_size() instead of hand-writing it. It is less verbose, more
> > robust and more informative.
> >
> > Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
>
> Reviewed-by: Marco Pagani <marpagan@redhat.com>
Applied to drm-misc-next
Thanks
Stanislaw
>
> > ---
> > drivers/accel/ivpu/ivpu_job.c | 4 +---
> > 1 file changed, 1 insertion(+), 3 deletions(-)
> >
> > diff --git a/drivers/accel/ivpu/ivpu_job.c b/drivers/accel/ivpu/ivpu_job.c
> > index 3c6f1e16cf2f..0a09bba8da24 100644
> > --- a/drivers/accel/ivpu/ivpu_job.c
> > +++ b/drivers/accel/ivpu/ivpu_job.c
> > @@ -289,15 +289,13 @@ ivpu_create_job(struct ivpu_file_priv *file_priv, u32 engine_idx, u32 bo_count)
> > {
> > struct ivpu_device *vdev = file_priv->vdev;
> > struct ivpu_job *job;
> > - size_t buf_size;
> > int ret;
> >
> > ret = ivpu_rpm_get(vdev);
> > if (ret < 0)
> > return NULL;
> >
> > - buf_size = sizeof(*job) + bo_count * sizeof(struct ivpu_bo *);
> > - job = kzalloc(buf_size, GFP_KERNEL);
> > + job = kzalloc(struct_size(job, bos, bo_count), GFP_KERNEL);
> > if (!job)
> > goto err_rpm_put;
> >
>
next prev parent reply other threads:[~2023-06-08 5:58 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-29 13:28 [PATCH] accel/ivpu: Use struct_size() Christophe JAILLET
2023-05-29 13:28 ` Christophe JAILLET
2023-06-01 15:58 ` Marco Pagani
2023-06-01 15:58 ` Marco Pagani
2023-06-08 5:57 ` Stanislaw Gruszka [this message]
2023-06-08 5:57 ` Stanislaw Gruszka
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230608055754.GD324119@linux.intel.com \
--to=stanislaw.gruszka@linux.intel.com \
--cc=christophe.jaillet@wanadoo.fr \
--cc=dri-devel@lists.freedesktop.org \
--cc=jacek.lawrynowicz@linux.intel.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marpagan@redhat.com \
--cc=ogabbay@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.