gpu/drm/nouveau/nvif: fix a null dereference in nvif_client_ctor()
Subsystems (3)
PATCH 1/1 gpu/drm/nouveau/nvif: fix a null dereference in nvif_client_ctor()
From: Alexandr Sapozhnikov <[email protected]>
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 <[email protected]>
--- drivers/gpu/drm/nouveau/nvif/client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nvif/client.c +1 -1
@@ -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),
Signature · 1 line
2.43.0
Quoted 2 lines
If the name parameter can be NULL, then you should not do strncpy before checking name for NULL.
Would a corresponding imperative wording become helpful for an improved change description?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.17#n94
Regards,
Markus