From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C62EE2F744C for ; Tue, 2 Sep 2025 16:20:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756830023; cv=none; b=KBRfElf72niy1KAL7h0khGryaLA3wXkoGbTuVN2gFq9f1Nn5RPpFQdCxh3wHeDmAzNC9DLloagG76RVg1UOtGAfH1EFuhWn8ogMDON1O1X9+n0shxXvl163qic5T7c6P4X4gGGFQ3PjSxp3SlaAYzxd92Ld5tZSRRaohczwbrbI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756830023; c=relaxed/simple; bh=rk0llnivH4+eI3fEBhIYvHN5LwY36Kp/31uOx14+eWQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ilA5XaMrEt4ZgiRoyhxMLOvUcJwxqSpr//Wkq/GP448n1w9KBbfe8yn/ozyKcU5TtekoyPsWaEjKW3woFYTNJwfa8c3tu7wlvTOcT6iXktSLz+gkG+K+A6HoVhqGP6fVcaCmyOOqgBrTETZYFOMqdieTMOsU+MprY4AgZQbPdfI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com 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 BC00B169C for ; Tue, 2 Sep 2025 09:20:12 -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 D160D3F6A8 for ; Tue, 2 Sep 2025 09:20:20 -0700 (PDT) Date: Tue, 2 Sep 2025 17:20:06 +0100 From: Liviu Dudau To: Chia-I Wu Cc: Boris Brezillon , Steven Price , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] drm/panthor: check bo offset alignment in vm bind Message-ID: References: <20250828200116.3532255-1-olvaffe@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20250828200116.3532255-1-olvaffe@gmail.com> On Thu, Aug 28, 2025 at 01:01:16PM -0700, Chia-I Wu wrote: > Fail early from panthor_vm_bind_prepare_op_ctx instead of late from > ops->map_pages. > > Signed-off-by: Chia-I Wu > Reviewed-by: Boris Brezillon Reviewed-by: Liviu Dudau Best regards, Liviu > --- > drivers/gpu/drm/panthor/panthor_mmu.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/panthor/panthor_mmu.c b/drivers/gpu/drm/panthor/panthor_mmu.c > index bad720f23eb70..6dec4354e3789 100644 > --- a/drivers/gpu/drm/panthor/panthor_mmu.c > +++ b/drivers/gpu/drm/panthor/panthor_mmu.c > @@ -1222,7 +1222,7 @@ static int panthor_vm_prepare_map_op_ctx(struct panthor_vm_op_ctx *op_ctx, > (flags & DRM_PANTHOR_VM_BIND_OP_TYPE_MASK) != DRM_PANTHOR_VM_BIND_OP_TYPE_MAP) > return -EINVAL; > > - /* Make sure the VA and size are aligned and in-bounds. */ > + /* Make sure the VA and size are in-bounds. */ > if (size > bo->base.base.size || offset > bo->base.base.size - size) > return -EINVAL; > > @@ -2447,7 +2447,7 @@ panthor_vm_bind_prepare_op_ctx(struct drm_file *file, > int ret; > > /* Aligned on page size. */ > - if (!IS_ALIGNED(op->va | op->size, vm_pgsz)) > + if (!IS_ALIGNED(op->va | op->size | op->bo_offset, vm_pgsz)) > return -EINVAL; > > switch (op->flags & DRM_PANTHOR_VM_BIND_OP_TYPE_MASK) { > -- > 2.51.0.318.gd7df087d1a-goog > -- ==================== | I would like to | | fix the world, | | but they're not | | giving me the | \ source code! / --------------- ¯\_(ツ)_/¯