[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <bddbec20-356b-468d-9c34-98a50c4f78a0@redhat.com>
Date: Mon, 12 Feb 2024 16:17:32 +0100
From: Danilo Krummrich <dakr@...hat.com>
To: Arnd Bergmann <arnd@...nel.org>, Karol Herbst <kherbst@...hat.com>,
Lyude Paul <lyude@...hat.com>, David Airlie <airlied@...il.com>,
Daniel Vetter <daniel@...ll.ch>, "Gustavo A. R. Silva"
<gustavoars@...nel.org>, Kees Cook <keescook@...omium.org>
Cc: Arnd Bergmann <arnd@...db.de>, Dave Airlie <airlied@...hat.com>,
Jani Nikula <jani.nikula@...el.com>, dri-devel@...ts.freedesktop.org,
nouveau@...ts.freedesktop.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] nouveau/svm: fix kvcalloc() argument order
On 2/12/24 12:22, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@...db.de>
>
> 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 <arnd@...db.de>
Applied to drm-misc-fixes, thanks!
> ---
> 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;
>
Powered by blists - more mailing lists