mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] drivers/nouveau_svm: fix bounds check in nouveau_svm_fault_buffer_dtor
@ 2020-08-16 14:51 Gaurav Singh
  0 siblings, 0 replies; only message in thread
From: Gaurav Singh @ 2020-08-16 14:51 UTC (permalink / raw)
  To: gaurav1086, Ben Skeggs, David Airlie, Daniel Vetter,
	open list:DRM DRIVER FOR NVIDIA GEFORCE/QUADRO GPUS,
	open list:DRM DRIVER FOR NVIDIA GEFORCE/QUADRO GPUS, open list

do the bounds check before accessing the buffer element.

Fixes: eeaf06ac1a558 ("drm/nouveau/svm: initial support for shared virtual memory")
Signed-off-by: Gaurav Singh <gaurav1086@gmail.com>
---
 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 6586d9d39874..35d24946787d 100644
--- a/drivers/gpu/drm/nouveau/nouveau_svm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_svm.c
@@ -897,7 +897,7 @@ nouveau_svm_fault_buffer_dtor(struct nouveau_svm *svm, int id)
 	int i;
 
 	if (buffer->fault) {
-		for (i = 0; buffer->fault[i] && i < buffer->entries; i++)
+		for (i = 0; i < buffer->entries && buffer->fault[i]; i++)
 			kfree(buffer->fault[i]);
 		kvfree(buffer->fault);
 	}
-- 
2.17.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-08-16 14:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-16 14:51 [PATCH] drivers/nouveau_svm: fix bounds check in nouveau_svm_fault_buffer_dtor Gaurav Singh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®