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 70860C9EC64 for ; Mon, 12 Jan 2026 10:22:54 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D827B10E329; Mon, 12 Jan 2026 10:22:52 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=igalia.com header.i=@igalia.com header.b="UqfvzaE1"; dkim-atps=neutral Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by gabe.freedesktop.org (Postfix) with ESMTPS id 39AC510E331 for ; Mon, 12 Jan 2026 10:22:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=UUWU7Wnj9ArXLe6ETpq9l5c5gdb7MUu5FPWiRbeS4vY=; b=UqfvzaE1hRs9/NNQKRFx0fUsRF hHrHmHAfpHujLooM2mmhepAOWxyaPyYx+T+x3EYKwPX+hDkXTcUxlL7Gwe+iv2oHZTm+BuLAaFBjS ybbsKbzW9bV9niXuf4u7A1XIkPInmMeHY2sBSV74dWpaBhQ0lt0OzXVWe8V47ZwLGuXW22o6Bhv2s XRiQFkBidLey0404FFtn/sBImuaZtmDxfTs8y+9WfM6vKJOlN9k8y67TLI6cKmmXJd6Xy2RW6psA2 vYKpP5ldbMkHM7cMejktDE5FKp43oZ9G/zBCRn8c9YzkBKesOKrkKQ9MGoyBSfHv5Hev4AbqFeB/M VGGq7htA==; Received: from [90.240.106.137] (helo=localhost) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1vfF4T-004LcL-ER; Mon, 12 Jan 2026 11:22:49 +0100 From: Tvrtko Ursulin To: amd-gfx@lists.freedesktop.org Cc: kernel-dev@igalia.com, =?UTF-8?q?Christian=20K=C3=B6nig?= , Alex Deucher , Tvrtko Ursulin Subject: [PATCH v4 03/12] drm/amdgpu: Drop support for variable struct drm_amdgpu_bo_list_entry size Date: Mon, 12 Jan 2026 10:22:35 +0000 Message-ID: <20260112102244.63308-4-tvrtko.ursulin@igalia.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260112102244.63308-1-tvrtko.ursulin@igalia.com> References: <20260112102244.63308-1-tvrtko.ursulin@igalia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: amd-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion list for AMD gfx List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: amd-gfx-bounces@lists.freedesktop.org Sender: "amd-gfx" Userspace always uses struct drm_amdgpu_bo_list_in->bo_info_size equal to sizeof(struct drm_amdgpu_bo_list_entry) and there are no plans to extend it. Even if the structure is extended at some point, older kernels will note that they do not support the additional fields by rejecting the new structure size. Signed-off-by: Tvrtko Ursulin Suggested-by: Christian König Reviewed-by: Christian König -- v2: * Expand commit message a bit. --- drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c | 31 +++++---------------- 1 file changed, 7 insertions(+), 24 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c index 87ec46c56a6e..d340a6438aaa 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c @@ -182,33 +182,16 @@ void amdgpu_bo_list_put(struct amdgpu_bo_list *list) int amdgpu_bo_create_list_entry_array(struct drm_amdgpu_bo_list_in *in, struct drm_amdgpu_bo_list_entry **info_param) { - const uint32_t info_size = sizeof(struct drm_amdgpu_bo_list_entry); - const void __user *uptr = u64_to_user_ptr(in->bo_info_ptr); - const uint32_t bo_info_size = in->bo_info_size; - const uint32_t bo_number = in->bo_number; struct drm_amdgpu_bo_list_entry *info; - /* copy the handle array from userspace to a kernel buffer */ - if (likely(info_size == bo_info_size)) { - info = vmemdup_array_user(uptr, bo_number, info_size); - if (IS_ERR(info)) - return PTR_ERR(info); - } else { - const uint32_t bytes = min(bo_info_size, info_size); - unsigned i; + if (in->bo_info_size != sizeof(struct drm_amdgpu_bo_list_entry)) + return -EINVAL; - info = kvmalloc_array(bo_number, info_size, GFP_KERNEL); - if (!info) - return -ENOMEM; - - memset(info, 0, bo_number * info_size); - for (i = 0; i < bo_number; ++i, uptr += bo_info_size) { - if (copy_from_user(&info[i], uptr, bytes)) { - kvfree(info); - return -EFAULT; - } - } - } + info = vmemdup_array_user(u64_to_user_ptr(in->bo_info_ptr), + in->bo_number, + sizeof(struct drm_amdgpu_bo_list_entry)); + if (IS_ERR(info)) + return PTR_ERR(info); *info_param = info; return 0; -- 2.52.0