From: Marco Pagani <marpagan@redhat.com>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>,
Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>,
Oded Gabbay <ogabbay@kernel.org>
Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] accel/ivpu: Use struct_size()
Date: Thu, 1 Jun 2023 17:58:48 +0200 [thread overview]
Message-ID: <3475be3b-11d5-96fe-6bc4-26d0e3a270df@redhat.com> (raw)
In-Reply-To: <0ae53be873c27c9a8740c4fe6d8e7cd1b1224994.1685366864.git.christophe.jaillet@wanadoo.fr>
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>
> ---
> 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-01 16:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-29 13:28 Christophe JAILLET
2023-06-01 15:58 ` Marco Pagani [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=3475be3b-11d5-96fe-6bc4-26d0e3a270df@redhat.com \
--to=marpagan@redhat.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=ogabbay@kernel.org \
--cc=stanislaw.gruszka@linux.intel.com \
/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 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®