From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id ACA83C2BD09 for ; Fri, 28 Jun 2024 19:19:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1582710ED11; Fri, 28 Jun 2024 19:19:26 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by gabe.freedesktop.org (Postfix) with ESMTP id 83C7210ED11 for ; Fri, 28 Jun 2024 19:19:24 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C79C8106F for ; Fri, 28 Jun 2024 12:19:48 -0700 (PDT) Received: from e110455-lin.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id A829B3F73B for ; Fri, 28 Jun 2024 12:19:23 -0700 (PDT) Date: Fri, 28 Jun 2024 20:19:15 +0100 From: Liviu Dudau To: Boris Brezillon Cc: Steven Price , =?utf-8?Q?Adri=C3=A1n?= Larumbe , 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 Message-ID: References: <20240628145536.778349-1-boris.brezillon@collabora.com> <20240628145536.778349-2-boris.brezillon@collabora.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20240628145536.778349-2-boris.brezillon@collabora.com> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Fri, Jun 28, 2024 at 04:55:35PM +0200, 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 Reviewed-by: Liviu Dudau Best regards, Liviu > --- > 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); > -- > 2.45.0 > -- ==================== | I would like to | | fix the world, | | but they're not | | giving me the | \ source code! / --------------- ¯\_(ツ)_/¯