From patchwork Thu Aug 10 18:41:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Airlie X-Patchwork-Id: 13349817 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 416E6C001DE for ; Thu, 10 Aug 2023 18:41:37 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3F31A10E5D5; Thu, 10 Aug 2023 18:41:36 +0000 (UTC) Received: from us-smtp-delivery-44.mimecast.com (unknown [207.211.30.44]) by gabe.freedesktop.org (Postfix) with ESMTPS id BD0C010E5D5 for ; Thu, 10 Aug 2023 18:41:33 +0000 (UTC) Received: from mimecast-mx02.redhat.com (66.187.233.73 [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-571-CchlRz1TPGa8t5h2FSUj1Q-1; Thu, 10 Aug 2023 14:41:19 -0400 X-MC-Unique: CchlRz1TPGa8t5h2FSUj1Q-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D20F51C0782D; Thu, 10 Aug 2023 18:41:18 +0000 (UTC) Received: from nomad.redhat.com (unknown [10.64.136.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9DAA0C15BAE; Thu, 10 Aug 2023 18:41:17 +0000 (UTC) From: Dave Airlie To: dri-devel@lists.freedesktop.org Subject: [PATCH] nouveau/u_memcpya: use kvmalloc_array. Date: Fri, 11 Aug 2023 04:41:16 +1000 Message-ID: <20230810184116.230831-1-airlied@gmail.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: gmail.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: , Cc: nouveau@lists.freedesktop.org, skeggsb@gmail.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Dave Airlie I think there are limit checks in places for most things but the new api wants to not have them. Signed-off-by: Dave Airlie --- drivers/gpu/drm/nouveau/nouveau_drv.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h b/drivers/gpu/drm/nouveau/nouveau_drv.h index 54063b094a69..6661f3057b72 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drv.h +++ b/drivers/gpu/drm/nouveau/nouveau_drv.h @@ -192,9 +192,7 @@ u_memcpya(uint64_t user, unsigned nmemb, unsigned size) void *mem; void __user *userptr = (void __force __user *)(uintptr_t)user; - size *= nmemb; - - mem = kvmalloc(size, GFP_KERNEL); + mem = kvmalloc_array(nmemb, size, GFP_KERNEL); if (!mem) return ERR_PTR(-ENOMEM);