[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20251002083332.11-1-alsp705@gmail.com>
Date: Thu, 2 Oct 2025 11:33:30 +0300
From: Alexandr Sapozhnkiov <alsp705@...il.com>
To: Karol Herbst <kherbst@...hat.com>,
Lyude Paul <lyude@...hat.com>,
Danilo Krummrich <dakr@...hat.com>,
David Airlie <airlied@...il.com>,
Daniel Vetter <daniel@...ll.ch>,
dri-devel@...ts.freedesktop.org,
nouveau@...ts.freedesktop.org,
linux-kernel@...r.kernel.org
Cc: Alexandr Sapozhnikov <alsp705@...il.com>,
lvc-project@...uxtesting.org
Subject: [PATCH] gpu/drm/nouveau/nvif: fix a null dereference in nvif_client_ctor()
From: Alexandr Sapozhnikov <alsp705@...il.com>
If the name parameter can be NULL, then you should not do
strncpy before checking name for NULL.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Signed-off-by: Alexandr Sapozhnikov <alsp705@...il.com>
---
drivers/gpu/drm/nouveau/nvif/client.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/nouveau/nvif/client.c b/drivers/gpu/drm/nouveau/nvif/client.c
index 3a27245f467f..3cfe420b5156 100644
--- a/drivers/gpu/drm/nouveau/nvif/client.c
+++ b/drivers/gpu/drm/nouveau/nvif/client.c
@@ -69,7 +69,7 @@ nvif_client_ctor(struct nvif_client *parent, const char *name, u64 device,
} nop = {};
int ret;
- strscpy_pad(args.name, name, sizeof(args.name));
+ strscpy_pad(args.name, name ? name : "nvifClient", sizeof(args.name));
ret = nvif_object_ctor(parent != client ? &parent->object : NULL,
name ? name : "nvifClient", 0,
NVIF_CLASS_CLIENT, &args, sizeof(args),
--
2.43.0
Powered by blists - more mailing lists