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 6CBC6CCF9FF for ; Fri, 31 Oct 2025 08:50:02 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CCAA210E2A4; Fri, 31 Oct 2025 08:50:01 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=collabora.com header.i=@collabora.com header.b="V2jlkPA7"; dkim-atps=neutral Received: from bali.collaboradmins.com (bali.collaboradmins.com [148.251.105.195]) by gabe.freedesktop.org (Postfix) with ESMTPS id 72A3510E2A4; Fri, 31 Oct 2025 08:50:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1761900598; bh=tzJ2aNT+TdXhEDg4BOMXnSkiNbzvOb7Pn4gIxc4/BzM=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=V2jlkPA7Kg2A/UpWR+uAehQ3Qk5UkUesVDGewNFo4kDUciZXoYmcjRKTZAl31yJIt jEYmEl7BeK04RRo3C5zZEyxDUljj3dwv57VJpGbDB/6nWVILBt8JtZ+ELaj/Kbg/9P QJNJnFR8DRo7xBM8u8HMA6kJMym8xUztr/RgeOiQyw9xPEofuf8ScAe+bcy+D14SXw BUqHISr5e575evfRevJ9QN2v1w3nE4TAaTpHf+SpN9uArYYQzS5Wd21/5BrRQWVZ56 iYw8havsV4lAivBHMTAll3EiYsTKDxDeumCXGhaQNJdYqul4lPidgkeKbfAgSJroq4 ApEr6tTLRGHxQ== Received: from fedora (unknown [IPv6:2a01:e0a:2c:6930:d919:a6e:5ea1:8a9f]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: bbrezillon) by bali.collaboradmins.com (Postfix) with ESMTPSA id CF5E517E00A6; Fri, 31 Oct 2025 09:49:57 +0100 (CET) Date: Fri, 31 Oct 2025 09:49:46 +0100 From: Boris Brezillon To: Marcin =?UTF-8?B?xZpsdXNhcno=?= Cc: Steven Price , dri-devel@lists.freedesktop.org, Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Faith Ekstrand , Thierry Reding , Mikko Perttunen , Melissa Wen , =?UTF-8?B?TWHDrXJh?= Canal , Lucas De Marchi , Thomas =?UTF-8?B?SGVsbHN0csO2bQ==?= , Rodrigo Vivi , Frank Binns , Matt Coster , Rob Clark , Dmitry Baryshkov , Abhinav Kumar , Jessica Zhang , Sean Paul , Marijn Suijten , Alex Deucher , Christian =?UTF-8?B?S8O2bmln?= , amd-gfx@lists.freedesktop.org, kernel@collabora.com, nd@arm.com Subject: Re: [PATCH v5 13/16] drm/panfrost: Add a PANFROST_SYNC_BO ioctl Message-ID: <20251031094946.6ab9a19f@fedora> In-Reply-To: References: <20251030140525.366636-1-boris.brezillon@collabora.com> <20251030140525.366636-14-boris.brezillon@collabora.com> Organization: Collabora X-Mailer: Claws Mail 4.3.1 (GTK 3.24.49; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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, 31 Oct 2025 08:08:20 +0100 Marcin =C5=9Alusarz wrote: > On Thu, Oct 30, 2025 at 03:05:22PM +0100, Boris Brezillon wrote: > > +static int panfrost_ioctl_sync_bo(struct drm_device *ddev, void *data, > > + struct drm_file *file) > > +{ > > + struct drm_panfrost_sync_bo *args =3D data; > > + struct drm_panfrost_bo_sync_op *ops; > > + struct drm_gem_object *obj; > > + int ret; > > + u32 i; > > + > > + if (args->pad) > > + return -EINVAL; > > + > > + ops =3D kvmalloc_array(args->op_count, sizeof(*ops), GFP_KERNEL); > > + if (!ops) { > > + DRM_DEBUG("Failed to allocate incoming BO sync ops array\n"); > > + return -ENOMEM; > > + } > > + > > + if (copy_from_user(ops, (void __user *)(uintptr_t)args->ops, > > + args->op_count * sizeof(*ops))) { > > + DRM_DEBUG("Failed to copy in BO sync ops\n"); > > + ret =3D -EFAULT; > > + goto err_ops; > > + } > > + > > + for (i =3D 0; i < args->op_count; i++) { > > + obj =3D drm_gem_object_lookup(file, ops[i].handle); > > + if (!obj) { > > + ret =3D -ENOENT; > > + goto err_ops; > > + } > > + > > + ret =3D panfrost_gem_sync(obj, ops[i].type, > > + ops[i].offset, ops[i].size); > > + > > + drm_gem_object_put(obj); > > + > > + if (ret) > > + goto err_ops; > > + } > > + > > +err_ops: > > + kvfree(ops); > > + > > + return ret; =20 >=20 > This function will still return garbage if args->op_count is 0. Sorry, this fell through the cracks. Will be fixed in v6.