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: 199662 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp2364829dyd; Mon, 12 Feb 2024 03:22:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IEGje/OiV0P1mV2ibEYnMzh9B1Tb+fDVZ53KAUVmFQstrcRU9kyvyCQeY6NP9uolTiyddSv X-Received: by 2002:a05:6808:1a07:b0:3c0:30af:16cd with SMTP id bk7-20020a0568081a0700b003c030af16cdmr6012371oib.50.1707736970162; Mon, 12 Feb 2024 03:22:50 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707736970; cv=pass; d=google.com; s=arc-20160816; b=CLCX10IV4SpYOtlL65LwDYUS33H3w99GP2zNQed9FUlJ6p5SGN9L1kb+UDbXtE88MZ 1oMMch4kP8XXn+smEblzeyLc2qKXfbyGszJcNJXa870WKVOJMIArhHeuC4vqnDVkRJiT 96Bd0S3hxipOfD1sA1lm3CRAXBHfI/gyIuTPw65vw0TxhT94jQ+vXhIi9jeORv2GWM4y +31857SQpMbe5AMUun34ObY27oXNcn8SSDNFAfNylhPc1Op1TO7sHtBDDQyxJxyJcYC8 Yw6UD+V8yJLIckBra55FLQ5Q3mXhMf9M/Hmr9N1xi1P3s1TQA8m7ZSNaJZHLKGE71EH+ 7cCQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=Cz4L3/D3mAUJwHsibzDrUpfTet+GzadFAMS3PB/Vc4g=; fh=qYrYALfTbgRoQx4BHLo6kEIAJ1Hsn1kv0gArGgb6Evc=; b=eb5XK/TAdfsUie9JUNw9/56bRjwjLDD7Nh3R/6njnnE6qlm7BmefWOQWXJdxbwFkTT 2BlmS+0+2hXGFXmFCiWCVKAIQNq9eYAPCPrWncGG+UNV6k7nUX7ubWADKVQlm8R72mp/ jOj22QPASuhN0T/O908wQ7OL0LsHNnqmKtAT+Z8FrLhporEBuDJo+iQNvtuBpQBfiM5U hHFEl7t6X1YKxjTfMmXF+7etPm21cwQlvpBM1BovSEs60AuPBj5jy1yCb4kDmnVznCaO FSULYo4wN0kvROWgD4O4FLLNZFAOBloxn0bHIqsERU02VaIfnd5BymgDRP61KPNDJrJi 93GA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CygLBY8X; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-61415-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61415-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=2; AJvYcCUpKUI2/cyLyHA4T8da476i+7fxB1YQLcsiHnOjmcCIu7tF6l57A/jhq4x/4k3mAXmuv9KEBX/aqTWkzcC7s/LvkIa7Eg== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id h16-20020ac846d0000000b0042c2e1586a4si127245qto.767.2024.02.12.03.22.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 03:22:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-61415-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CygLBY8X; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-61415-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61415-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id E76FD1C2183A for ; Mon, 12 Feb 2024 11:22:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 695113984D; Mon, 12 Feb 2024 11:22:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="CygLBY8X" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CDAC438DE1 for ; Mon, 12 Feb 2024 11:22:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707736956; cv=none; b=ciE7GevXyaGfdfv0bubCdmuz6514QIXzmdOiGrNFQl67CRqYI2MnIJth7HJarDXi0Z38qroZus6SzDDfXp0bp4racWwfUOwWArern1+bum8yf57EULXW6VgElU5UtizGNdDEXacApw01en4KycEd5jwWDvnJ2JqeAgenaok85Go= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707736956; c=relaxed/simple; bh=4C5nZGco26sonFA2eNFl58Z2ow6XP0jrBTogGeyvF7M=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=pCem9RjHWqILqkinwLResYyiLigh2tQkaxKj7PYLQn0dHXwAFNuvFOzjkkg/UUeq94I5/Zw8YicD19SHUv4DUMuuOoBKLkHEr3Hw1pX2hab98YqsDuhYN6mPcAepMGMfQP4aCPtHqMfQ2sczTXTfN41swTg6zYso5ol4I4qWk4I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=CygLBY8X; arc=none smtp.client-ip=10.30.226.201 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 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790692000815909181 X-GMAIL-MSGID: 1790692000815909181 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;