From patchwork Mon Feb 12 11:22:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 13552960 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 7B60EC4829B for ; Mon, 12 Feb 2024 11:22:44 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8CA6F10EB58; Mon, 12 Feb 2024 11:22:41 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="CygLBY8X"; dkim-atps=neutral Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by gabe.freedesktop.org (Postfix) with ESMTPS id 664D910E548; Mon, 12 Feb 2024 11:22:40 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 9BF0C60F55; Mon, 12 Feb 2024 11:22:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 81EFDC433C7; Mon, 12 Feb 2024 11:22:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707736956; bh=4C5nZGco26sonFA2eNFl58Z2ow6XP0jrBTogGeyvF7M=; h=From:To:Cc:Subject:Date:From; b=CygLBY8XhV8HOEbO2Yhqk49rWMjOa8t2XLVwB952Zz4Bn5kxp5qwPCPwj6HZhry+M ONK37SaoxMjxxOqj6C4rHrZzvJp/ArzDLuID/k7Ii2qYxHlnmZ7Y022pDFbWlcEq2i xaYEp2k8aUx4AkjEA4ekWKpu+lqThQHgBVjee8XR4SI3IJVazSwqTit59Mhqt60bs7 ZqpVppMJxzsAiodFBPS9eJ3C+3oDXxa/00VxMMGxnPpkfVU9t7QfG7XwQUR0JmP9Jx rDGkdxt3oHqtyzYakpPU2f085hoUlMnvvb3VDUNrmjscFJAe4gkI+/yMqEj0h+mfb+ 6xwEdiygBPvKg== From: Arnd Bergmann To: Karol Herbst , Lyude Paul , Danilo Krummrich , David Airlie , Daniel Vetter , "Gustavo A. R. Silva" , Kees Cook Cc: Arnd Bergmann , Dave Airlie , Jani Nikula , dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH] nouveau/svm: fix kvcalloc() argument order Date: Mon, 12 Feb 2024 12:22:17 +0100 Message-Id: <20240212112230.1117284-1-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 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" From: Arnd Bergmann The conversion to kvcalloc() mixed up the object size and count arguments, causing a warning: drivers/gpu/drm/nouveau/nouveau_svm.c: In function 'nouveau_svm_fault_buffer_ctor': drivers/gpu/drm/nouveau/nouveau_svm.c:1010:40: error: 'kvcalloc' sizes specified with 'sizeof' in the earlier argument and not in the later argument [-Werror=calloc-transposed-args] 1010 | buffer->fault = kvcalloc(sizeof(*buffer->fault), buffer->entries, GFP_KERNEL); | ^ drivers/gpu/drm/nouveau/nouveau_svm.c:1010:40: note: earlier argument should specify number of elements, later size of each element The behavior is still correct aside from the warning, but fixing it avoids the warnings and can help the compiler track the individual objects better. Fixes: 71e4bbca070e ("nouveau/svm: Use kvcalloc() instead of kvzalloc()") Signed-off-by: Arnd Bergmann --- drivers/gpu/drm/nouveau/nouveau_svm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_svm.c b/drivers/gpu/drm/nouveau/nouveau_svm.c index 4d1008915499..b4da82ddbb6b 100644 --- a/drivers/gpu/drm/nouveau/nouveau_svm.c +++ b/drivers/gpu/drm/nouveau/nouveau_svm.c @@ -1007,7 +1007,7 @@ nouveau_svm_fault_buffer_ctor(struct nouveau_svm *svm, s32 oclass, int id) if (ret) return ret; - buffer->fault = kvcalloc(sizeof(*buffer->fault), buffer->entries, GFP_KERNEL); + buffer->fault = kvcalloc(buffer->entries, sizeof(*buffer->fault), GFP_KERNEL); if (!buffer->fault) return -ENOMEM;