dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Steven Price <steven.price@arm.com>
To: "Boris Brezillon" <boris.brezillon@collabora.com>,
	"Liviu Dudau" <liviu.dudau@arm.com>,
	"Adrián Larumbe" <adrian.larumbe@collabora.com>
Cc: dri-devel@lists.freedesktop.org, kernel@collabora.com
Subject: Re: [PATCH 1/2] drm/panthor: Don't check the array stride on empty uobj arrays
Date: Mon, 1 Jul 2024 10:03:08 +0100	[thread overview]
Message-ID: <bfc7f7f7-e25f-497c-9294-438315d3d647@arm.com> (raw)
In-Reply-To: <20240628145536.778349-2-boris.brezillon@collabora.com>

On 28/06/2024 15:55, Boris Brezillon wrote:
> The user is likely to leave all the drm_panthor_obj_array fields
> to zero when the array is empty, which will cause an EINVAL failure.
> 
> Fixes: 4bdca1150792 ("drm/panthor: Add the driver frontend block")
> Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>

Reviewed-by: Steven Price <steven.price@arm.com>

> ---
>  drivers/gpu/drm/panthor/panthor_drv.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/panthor/panthor_drv.c b/drivers/gpu/drm/panthor/panthor_drv.c
> index b8a84f26b3ef..b5e7b919f241 100644
> --- a/drivers/gpu/drm/panthor/panthor_drv.c
> +++ b/drivers/gpu/drm/panthor/panthor_drv.c
> @@ -86,15 +86,15 @@ panthor_get_uobj_array(const struct drm_panthor_obj_array *in, u32 min_stride,
>  	int ret = 0;
>  	void *out_alloc;
>  
> +	if (!in->count)
> +		return NULL;
> +
>  	/* User stride must be at least the minimum object size, otherwise it might
>  	 * lack useful information.
>  	 */
>  	if (in->stride < min_stride)
>  		return ERR_PTR(-EINVAL);
>  
> -	if (!in->count)
> -		return NULL;
> -
>  	out_alloc = kvmalloc_array(in->count, obj_size, GFP_KERNEL);
>  	if (!out_alloc)
>  		return ERR_PTR(-ENOMEM);


  parent reply	other threads:[~2024-07-01  9:03 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-28 14:55 [PATCH 0/2] drm/panthor: Fix support for sync-only jobs Boris Brezillon
2024-06-28 14:55 ` [PATCH 1/2] drm/panthor: Don't check the array stride on empty uobj arrays Boris Brezillon
2024-06-28 19:19   ` Liviu Dudau
2024-07-01  9:03   ` Steven Price [this message]
2024-06-28 14:55 ` [PATCH 2/2] drm/panthor: Fix sync-only jobs Boris Brezillon
2024-06-28 21:34   ` Liviu Dudau
2024-06-29  8:52     ` Boris Brezillon
2024-06-29 12:10       ` Liviu Dudau
2024-07-01  6:59         ` Boris Brezillon
2024-07-01  9:03   ` Steven Price
2024-07-01 11:02   ` kernel test robot
2024-07-02 15:13   ` Boris Brezillon

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=bfc7f7f7-e25f-497c-9294-438315d3d647@arm.com \
    --to=steven.price@arm.com \
    --cc=adrian.larumbe@collabora.com \
    --cc=boris.brezillon@collabora.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kernel@collabora.com \
    --cc=liviu.dudau@arm.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;
as well as URLs for NNTP newsgroup(s).