projects
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
5e78d59
)
nouveau/svm: Use struct_size() helper in nouveau_pfns_map()
author
Gustavo A. R. Silva
<gustavoars@kernel.org>
Mon, 7 Feb 2022 23:39:23 +0000
(17:39 -0600)
committer
Lyude Paul
<lyude@redhat.com>
Tue, 8 Feb 2022 20:11:22 +0000
(15:11 -0500)
Make use of the struct_size() helper instead of an open-coded version,
in order to avoid any potential type mistakes or integer overflows that,
in the worse scenario, could lead to heap overflows.
Link:
https://github.com/KSPP/linux/issues/160
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: Lyude Paul <lyude@redhat.com>
Link:
https://patchwork.freedesktop.org/patch/msgid/20220207233923.GA524723@embeddedor
drivers/gpu/drm/nouveau/nouveau_svm.c
patch
|
blob
|
history
diff --git
a/drivers/gpu/drm/nouveau/nouveau_svm.c
b/drivers/gpu/drm/nouveau/nouveau_svm.c
index 266809e511e2c18a1de677a79f33d6cc5d4c52fb..46a5a1016e37363c3254eae69475c15803c17857 100644
(file)
--- a/
drivers/gpu/drm/nouveau/nouveau_svm.c
+++ b/
drivers/gpu/drm/nouveau/nouveau_svm.c
@@
-925,8
+925,8
@@
nouveau_pfns_map(struct nouveau_svmm *svmm, struct mm_struct *mm,
mutex_lock(&svmm->mutex);
- ret = nvif_object_ioctl(&svmm->vmm->vmm.object, args,
sizeof(*args) +
-
npages * sizeof(args->p.phys[0]
), NULL);
+ ret = nvif_object_ioctl(&svmm->vmm->vmm.object, args,
+
struct_size(args, p.phys, npages
), NULL);
mutex_unlock(&svmm->mutex);
}